diff options
author | Eric Blake <ebb9@byu.net> | 2009-09-04 21:22:21 -0600 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2009-09-04 21:26:36 -0600 |
commit | c46ae39631773a7fdae7d171cc4ef0bf2123efff (patch) | |
tree | b7ae29b257c45ec691eb8bbedcc864f86d291615 /lib/openat-proc.c | |
parent | 8a0efd04dc9583c96b4a0d3c311ff216e07dcdcd (diff) | |
download | gnulib-c46ae39631773a7fdae7d171cc4ef0bf2123efff.tar.gz |
openat: fail with ENOENT on empty name
* lib/openat-proc.c (openat_proc_name): Special-case the empty
buffer.
Signed-off-by: Eric Blake <ebb9@byu.net>
Diffstat (limited to 'lib/openat-proc.c')
-rw-r--r-- | lib/openat-proc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/openat-proc.c b/lib/openat-proc.c index 8057033e86..76e1c6dd51 100644 --- a/lib/openat-proc.c +++ b/lib/openat-proc.c @@ -57,6 +57,13 @@ openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int fd, char const *file) { static int proc_status = 0; + /* Make sure the caller gets ENOENT when appropriate. */ + if (!*file) + { + buf[0] = '\0'; + return buf; + } + if (! proc_status) { /* Set PROC_STATUS to a positive value if /proc/self/fd is |