1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

Use futimens instead of utimes.

This commit is contained in:
Giuseppe Scrivano 2011-04-19 12:33:46 +02:00
parent a50931df8c
commit 87a176daa7
6 changed files with 30 additions and 11 deletions

View File

@ -30,9 +30,11 @@ alloca
announce-gen announce-gen
bind bind
c-ctype c-ctype
clock-time
close close
connect connect
fcntl fcntl
futimens
getaddrinfo getaddrinfo
getopt-gnu getopt-gnu
getpass-gnu getpass-gnu

View File

@ -1,5 +1,9 @@
2011-04-19 Giuseppe Scrivano <gscrivano@gnu.org> 2011-04-19 Giuseppe Scrivano <gscrivano@gnu.org>
* Makefile.am (LIBS): Add $(LIB_CLOCK_GETTIME)
* utils.c: Include <sys/stat.h>. Do not include <sys/time.h>.
(touch): Use `futimens' instead of `utimes'.
* mswindows.h: Do not include <direct.h>. Remove macro definition for * mswindows.h: Do not include <direct.h>. Remove macro definition for
mkdir. mkdir.

View File

@ -37,7 +37,7 @@ endif
# The following line is losing on some versions of make! # The following line is losing on some versions of make!
DEFS = @DEFS@ -DSYSTEM_WGETRC=\"$(sysconfdir)/wgetrc\" -DLOCALEDIR=\"$(localedir)\" DEFS = @DEFS@ -DSYSTEM_WGETRC=\"$(sysconfdir)/wgetrc\" -DLOCALEDIR=\"$(localedir)\"
LIBS = @LIBICONV@ @LIBINTL@ @LIBS@ LIBS = @LIBICONV@ @LIBINTL@ @LIBS@ $(LIB_CLOCK_GETTIME)
bin_PROGRAMS = wget bin_PROGRAMS = wget
wget_SOURCES = cmpt.c connect.c convert.c cookies.c ftp.c \ wget_SOURCES = cmpt.c connect.c convert.c cookies.c ftp.c \

View File

@ -51,8 +51,7 @@ as that of the covered work. */
#include <stdarg.h> #include <stdarg.h>
#include <locale.h> #include <locale.h>
#include <sys/time.h> #include <sys/stat.h>
/* For TIOCGWINSZ and friends: */ /* For TIOCGWINSZ and friends: */
#ifdef HAVE_SYS_IOCTL_H #ifdef HAVE_SYS_IOCTL_H
@ -488,15 +487,25 @@ fork_to_background (void)
void void
touch (const char *file, time_t tm) touch (const char *file, time_t tm)
{ {
struct timeval timevals[2]; struct timespec timespecs[2];
int fd;
timevals[0].tv_sec = time (NULL); fd = open (file, O_WRONLY);
timevals[0].tv_usec = 0L; if (fd < 0)
timevals[1].tv_sec = tm; {
timevals[1].tv_usec = 0L; logprintf (LOG_NOTQUIET, "open(%s): %s\n", file, strerror (errno));
return;
}
if (utimes (file, timevals) == -1) timespecs[0].tv_sec = time (NULL);
logprintf (LOG_NOTQUIET, "utimes(%s): %s\n", file, strerror (errno)); timespecs[0].tv_nsec = 0L;
timespecs[1].tv_sec = tm;
timespecs[1].tv_nsec = 0L;
if (futimens (fd, timespecs) == -1)
logprintf (LOG_NOTQUIET, "futimens(%s): %s\n", file, strerror (errno));
close (fd);
} }
/* Checks if FILE is a symbolic link, and removes it if it is. Does /* Checks if FILE is a symbolic link, and removes it if it is. Does

View File

@ -1,3 +1,7 @@
2011-04-19 Giuseppe Scrivano <gscrivano@gnu.org>
* Makefile.am (LIBS): Add $(LIB_CLOCK_GETTIME).
2011-04-04 Giuseppe Scrivano <gscrivano@gnu.org> 2011-04-04 Giuseppe Scrivano <gscrivano@gnu.org>
* Makefile.am (LIBS): Remove @LIBSSL@ @W32LIBS@ * Makefile.am (LIBS): Remove @LIBSSL@ @W32LIBS@

View File

@ -34,7 +34,7 @@
PERL = perl PERL = perl
PERLRUN = $(PERL) -I$(srcdir) PERLRUN = $(PERL) -I$(srcdir)
LIBS = @LIBICONV@ @LIBINTL@ @LIBS@ LIBS = @LIBICONV@ @LIBINTL@ @LIBS@ $(LIB_CLOCK_GETTIME)
.PHONY: test run-unit-tests run-px-tests .PHONY: test run-unit-tests run-px-tests