summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-02-03 09:43:55 +0000
committerJakub Jelinek <jakub@redhat.com>2006-02-03 09:43:55 +0000
commit36dbaf996768766212ecab9ef72ea181629cc02d (patch)
treed059c4e37f1948045342b01d3255a512fd13a2f2
parente6001d3152ab6cd6246fad22ea02f4a9699661d3 (diff)
* sysdeps/unix/sysv/linux/futimesat.c (futimesat): If
file == NULL, use __futimes unconditionally. * manual/filesys.texi (futimes): Fix prototype.
-rw-r--r--ChangeLog7
-rw-r--r--manual/filesys.texi2
-rw-r--r--sysdeps/unix/sysv/linux/futimesat.c23
3 files changed, 12 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 77405ff2a0..202ae32a38 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-02-03 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/unix/sysv/linux/futimesat.c (futimesat): If
+ file == NULL, use __futimes unconditionally.
+
+ * manual/filesys.texi (futimes): Fix prototype.
+
2006-02-02 Jakub Jelinek <jakub@redhat.com>
* math/math.h (__nldbl_nexttowardf): Put __THROW before
diff --git a/manual/filesys.texi b/manual/filesys.texi
index c8ae377266..2436f22e88 100644
--- a/manual/filesys.texi
+++ b/manual/filesys.texi
@@ -2806,7 +2806,7 @@ function.
@comment sys/time.h
@comment BSD
-@deftypefun int futimes (int *@var{fd}, struct timeval @var{tvp}@t{[2]})
+@deftypefun int futimes (int @var{fd}, struct timeval @var{tvp}@t{[2]})
This function is like @code{utimes}, except that it takes an open file
descriptor as an argument instead of a file name. @xref{Low-Level
I/O}. This function comes from FreeBSD, and is not available on all
diff --git a/sysdeps/unix/sysv/linux/futimesat.c b/sysdeps/unix/sysv/linux/futimesat.c
index 7c96b78045..5f3a3f52f3 100644
--- a/sysdeps/unix/sysv/linux/futimesat.c
+++ b/sysdeps/unix/sysv/linux/futimesat.c
@@ -37,14 +37,14 @@ futimesat (fd, file, tvp)
{
int result;
+ if (file == NULL)
+ return __futimes (fd, tvp);
+
#ifdef __NR_futimesat
# ifndef __ASSUME_ATFCTS
if (__have_atfcts >= 0)
# endif
{
- if (file == NULL)
- return __futimes (fd, tvp);
-
result = INLINE_SYSCALL (futimesat, 3, fd, file, tvp);
# ifndef __ASSUME_ATFCTS
if (result == -1 && errno == ENOSYS)
@@ -58,22 +58,7 @@ futimesat (fd, file, tvp)
#ifndef __ASSUME_ATFCTS
char *buf = NULL;
- 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] != '/')
+ if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
static const char procfd[] = "/proc/self/fd/%d/%s";