summaryrefslogtreecommitdiff
path: root/lib/utimens.c
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-03-05 10:06:12 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-03-05 10:06:12 +0900
commit1d8b652baba3df2da0eb42560205cab2ccb360e9 (patch)
treec546e30de11fdb2d144057d59b9c0d5f0f2539d5 /lib/utimens.c
parent81f1c64e30d2ea59604a628bca9f1d04b1f82afb (diff)
downloadwget-1d8b652baba3df2da0eb42560205cab2ccb360e9.tar.gz
wget-1d8b652baba3df2da0eb42560205cab2ccb360e9.tar.bz2
wget-1d8b652baba3df2da0eb42560205cab2ccb360e9.zip
Imported Upstream version 1.14upstream/1.14
Diffstat (limited to 'lib/utimens.c')
-rw-r--r--lib/utimens.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/utimens.c b/lib/utimens.c
index c190411..f06918c 100644
--- a/lib/utimens.c
+++ b/lib/utimens.c
@@ -1,6 +1,6 @@
/* Set file access and modification times.
- Copyright (C) 2003-2011 Free Software Foundation, Inc.
+ Copyright (C) 2003-2012 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
@@ -21,6 +21,7 @@
#include <config.h>
+#define _GL_UTIMENS_INLINE _GL_EXTERN_INLINE
#include "utimens.h"
#include <assert.h>
@@ -180,18 +181,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