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:
Jan Nieuwenhuizen 2018-12-07 20:18:01 +01:00
parent 0a32045caf
commit 5f14a46422
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273

View file

@ -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)
{