Merge "bionic: fix NULL parameter failure in getcwd()"

This commit is contained in:
Elliott Hughes 2012-04-16 08:48:19 -07:00 committed by android code review
commit 6435d27f9d

View File

@ -26,10 +26,15 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include <unistd.h> #include <unistd.h>
#include <errno.h>
extern int __getcwd(char * buf, size_t size); extern int __getcwd(char * buf, size_t size);
char *getcwd(char *buf, size_t size) char *getcwd(char *buf, size_t size)
{ {
if (buf == NULL || size == 0) {
errno = EINVAL;
return NULL;
}
return ( __getcwd(buf, size) < 0 ) ? NULL : buf; return ( __getcwd(buf, size) < 0 ) ? NULL : buf;
} }