[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gnulib] utimens patch for GNU/Linux without futimes and /proc
From: |
Paul Eggert |
Subject: |
[bug-gnulib] utimens patch for GNU/Linux without futimes and /proc |
Date: |
Tue, 18 Jan 2005 14:07:34 -0800 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
I installed this patch from coreutils:
2005-01-18 Paul Eggert <address@hidden>
* utimens.c (futimens): Robustify the previous patch, by checking
for known valid error numbers rather than observed invalid ones.
2005-01-18 Jim Meyering <address@hidden>
* utimens.c (futimens): Account for the fact that futimes
can also fail with errno == ENOSYS or errno == ENOENT.
Patch from Dmitry V. Levin.
Index: lib/utimens.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/utimens.c,v
retrieving revision 1.2
diff -p -u -r1.2 utimens.c
--- lib/utimens.c 23 Nov 2004 20:59:33 -0000 1.2
+++ lib/utimens.c 18 Jan 2005 22:03:16 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -24,6 +24,8 @@
#include "utimens.h"
+#include <errno.h>
+
#if HAVE_UTIME_H
# include <utime.h>
#endif
@@ -74,7 +76,22 @@ futimens (int fd ATTRIBUTE_UNUSED,
t = NULL;
# if HAVE_FUTIMES
if (0 <= fd)
- return futimes (fd, t);
+ {
+ if (futimes (fd, t) == 0)
+ return 0;
+
+ /* On GNU/Linux without the futimes syscall and without /proc
+ mounted, glibc futimes fails with errno == ENOENT. Fall back
+ on utimes if we get a weird error number like that. */
+ switch (errno)
+ {
+ case EACCES:
+ case EIO:
+ case EPERM:
+ case EROFS:
+ return -1;
+ }
+ }
# endif
return utimes (file, t);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug-gnulib] utimens patch for GNU/Linux without futimes and /proc,
Paul Eggert <=