[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] utimens: remove dependency on dup2
From: |
Paul Eggert |
Subject: |
[PATCH] utimens: remove dependency on dup2 |
Date: |
Sun, 18 Sep 2011 20:59:01 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.21) Gecko/20110831 Thunderbird/3.1.13 |
* lib/utimens.c (fdutimens): Don't invoke dup2; it's not needed
to work around the Linux kernel bug.
* modules/utimens (Depends-on): Remove dup2.
---
ChangeLog | 7 +++++++
lib/utimens.c | 13 ++++---------
modules/utimens | 1 -
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a2e395d..382b79c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-09-18 Paul Eggert <address@hidden>
+
+ utimens: remove dependency on dup2
+ * lib/utimens.c (fdutimens): Don't invoke dup2; it's not needed
+ to work around the Linux kernel bug.
+ * modules/utimens (Depends-on): Remove dup2.
+
2011-09-18 Bruno Haible <address@hidden>
inet_ntop, inet_pton: Look for it also in libresolv.
diff --git a/lib/utimens.c b/lib/utimens.c
index c190411..f7cb8de 100644
--- a/lib/utimens.c
+++ b/lib/utimens.c
@@ -180,18 +180,13 @@ fdutimens (int fd, char const *file, struct timespec
const timespec[2])
if (adjustment_needed < 0)
return -1;
- /* Require that at least one of FD or FILE are valid. Works around
+ /* Require that at least one of FD or FILE are potentially valid, to avoid
a Linux bug where futimens (AT_FDCWD, NULL) changes "." rather
than failing. */
- if (!file)
+ if (fd < 0 && !file)
{
- if (fd < 0)
- {
- errno = EBADF;
- return -1;
- }
- if (dup2 (fd, fd) != fd)
- return -1;
+ errno = EBADF;
+ return -1;
}
/* Some Linux-based NFS clients are buggy, and mishandle time stamps
diff --git a/modules/utimens b/modules/utimens
index 1a9687f..c607608 100644
--- a/modules/utimens
+++ b/modules/utimens
@@ -9,7 +9,6 @@ m4/utimens.m4
m4/utimes.m4
Depends-on:
-dup2
errno
lstat
gettime
--
1.7.4.4
- [PATCH] utimens: remove dependency on dup2,
Paul Eggert <=