diff options
author | Ulrich Drepper <drepper@redhat.com> | 2009-10-29 21:33:26 -0700 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2009-10-29 21:33:26 -0700 |
commit | 801720e63b20e3b8215764ff0d68a29534ca7e62 (patch) | |
tree | b855ff7b284eadc784013c078f54978464687243 /sysdeps/unix/sysv/linux/fchmodat.c | |
parent | 584715c3a9b0030729e0a8504c820b3bd8d9353d (diff) | |
download | glibc-801720e63b20e3b8215764ff0d68a29534ca7e62.tar.gz |
Fix compat handling in *at functions.
When passed an empty string for the filename, the compat code
using /proc in all *at functions did the wrong thing.
Diffstat (limited to 'sysdeps/unix/sysv/linux/fchmodat.c')
-rw-r--r-- | sysdeps/unix/sysv/linux/fchmodat.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/fchmodat.c b/sysdeps/unix/sysv/linux/fchmodat.c index 8b420153f1..051691230d 100644 --- a/sysdeps/unix/sysv/linux/fchmodat.c +++ b/sysdeps/unix/sysv/linux/fchmodat.c @@ -1,5 +1,5 @@ /* Change the protections of file relative to open directory. Linux version. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -71,6 +71,12 @@ fchmodat (fd, file, mode, flag) if (fd != AT_FDCWD && file[0] != '/') { size_t filelen = strlen (file); + if (__builtin_expect (filelen == 0, 0)) + { + __set_errno (ENOENT); + return -1; + } + static const char procfd[] = "/proc/self/fd/%d/%s"; /* Buffer for the path name we are going to use. It consists of - the string /proc/self/fd/ |