mescc: getcwd: Support getcwd (0, 0) GNU extension.
* lib/linux/libc.c (_getcwd): Rename from getcwd. (_getcwd): New function. Support getcwd (0, 0) GNU extension.
This commit is contained in:
parent
0a32045caf
commit
5f14a46422
|
@ -21,6 +21,7 @@
|
|||
#include <libmes.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -151,7 +152,7 @@ fsync (int filedes)
|
|||
}
|
||||
|
||||
char *
|
||||
getcwd (char *buffer, size_t size)
|
||||
_getcwd (char *buffer, size_t size)
|
||||
{
|
||||
int r = _sys_call2 (SYS_getcwd, (long)buffer, (long)size);
|
||||
if (r >= 0)
|
||||
|
@ -159,6 +160,15 @@ getcwd (char *buffer, size_t size)
|
|||
return 0;
|
||||
}
|
||||
|
||||
char *
|
||||
getcwd (char *buffer, size_t size)
|
||||
{
|
||||
static char buf[PATH_MAX];
|
||||
if (buffer)
|
||||
return _getcwd (buffer, size);
|
||||
return _getcwd (buf, PATH_MAX);
|
||||
}
|
||||
|
||||
int
|
||||
dup (int old)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue