merge from open-source master

Change-Id: Iecfd2bd3069f70bbe508042cc249fcf7ff24800d
This commit is contained in:
The Android Open Source Project
2010-05-12 09:22:50 -07:00
8 changed files with 90 additions and 23 deletions

View File

@@ -205,8 +205,6 @@ __fremovelock(FILE* fp)
lock->file = NULL;
}
lock_table_unlock(t);
if (lock != NULL)
free(lock);
free(lock);
}
}

View File

@@ -31,12 +31,14 @@
char* strndup(const char* s, size_t n)
{
size_t slen = (size_t)strlen(s);
int len = slen < n ? slen : n;
char* copy = malloc(len+1);
char* copy;
if (slen < n)
n = slen;
copy = malloc(n+1);
if (copy) {
memcpy( copy, s, len );
copy[len] = 0;
memcpy(copy, s, n);
copy[n] = 0;
}
return copy;
}