bionic: fix NULL parameter failure in getcwd()
LTP: getcwd01 failed in LTP Need to check getcwd parameters, otherwise it will lead to posix test case to fail. Change-Id: Ieb673b6dd4ca6481da81c5339dbf7ec0a463f263 Signed-off-by: Jin Wei <wei.a.jin@intel.com> Signed-off-by: Jack Ren <jack.ren@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
This commit is contained in:
parent
6bc18fa588
commit
e5bf068147
@ -26,10 +26,15 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
extern int __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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user