From 66b987ac3bcbe9dfc1ee4eb76dddeb1d5f9f30b2 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 8 Feb 2007 18:25:57 +0000 Subject: handle file_name==NULL and file_name=="" as required by POSIX --- libc/stdlib/realpath.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libc/stdlib/realpath.c') 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); -- cgit v1.2.3