diff options
author | Jakub Jelinek <jakub@redhat.com> | 2005-11-19 20:05:14 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2005-11-19 20:05:14 +0000 |
commit | 8e8c8d3c871666d3c4fb0cda0147fb2231beeb09 (patch) | |
tree | 8205dc9da58d4c3090372b155fdede74e7b3d6b1 /sysdeps/unix/sysv/linux/futimesat.c | |
parent | b9616a4d2d0ff113b95a638127ad27c98e6c713b (diff) |
Updated to fedora-glibc-20051119T1959
Diffstat (limited to 'sysdeps/unix/sysv/linux/futimesat.c')
-rw-r--r-- | sysdeps/unix/sysv/linux/futimesat.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/futimesat.c b/sysdeps/unix/sysv/linux/futimesat.c index 7ab0477c5e..8a87cc442b 100644 --- a/sysdeps/unix/sysv/linux/futimesat.c +++ b/sysdeps/unix/sysv/linux/futimesat.c @@ -37,7 +37,22 @@ futimesat (fd, file, tvp) { char *buf = NULL; - if (fd != AT_FDCWD && file[0] != '/') + if (file == NULL) + { + static const char procfd[] = "/proc/self/fd/%d"; + /* Buffer for the path name we are going to use. It consists of + - the string /proc/self/fd/ + - the file descriptor number. + The final NUL is included in the sizeof. A bit of overhead + due to the format elements compensates for possible negative + numbers. */ + size_t buflen = sizeof (procfd) + sizeof (int) * 3; + buf = alloca (buflen); + + __snprintf (buf, buflen, procfd, fd); + file = buf; + } + else if (fd != AT_FDCWD && file[0] != '/') { size_t filelen = strlen (file); static const char procfd[] = "/proc/self/fd/%d/%s"; |