diff options
author | Mike Frysinger <vapier@gentoo.org> | 2007-02-08 18:25:57 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2007-02-08 18:25:57 +0000 |
commit | 66b987ac3bcbe9dfc1ee4eb76dddeb1d5f9f30b2 (patch) | |
tree | 0cb0907783c43f1055249d137b466a910de886f0 /libc/stdlib/realpath.c | |
parent | b56c113af85ffe0dc7a2780be767b5925296385f (diff) |
handle file_name==NULL and file_name=="" as required by POSIX
Diffstat (limited to 'libc/stdlib/realpath.c')
-rw-r--r-- | libc/stdlib/realpath.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libc/stdlib/realpath.c b/libc/stdlib/realpath.c index b7c7ef413..aae8580a5 100644 --- a/libc/stdlib/realpath.c +++ b/libc/stdlib/realpath.c @@ -58,6 +58,14 @@ char resolved_path[]; int readlinks = 0; int n; + if (path == NULL) { + __set_errno(EINVAL); + return NULL; + } + if (*path == '\0') { + __set_errno(ENOENT); + return NULL; + } /* Make a copy of the source path since we may need to modify it. */ if (strlen(path) >= PATH_MAX - 2) { __set_errno(ENAMETOOLONG); |