diff --git a/bootstrap.conf b/bootstrap.conf index 76de9805..0b16175f 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -30,9 +30,11 @@ alloca announce-gen bind c-ctype +clock-time close connect fcntl +futimens getaddrinfo getopt-gnu getpass-gnu diff --git a/src/ChangeLog b/src/ChangeLog index 19d5f4bf..1bbc6acc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2011-04-19 Giuseppe Scrivano + * Makefile.am (LIBS): Add $(LIB_CLOCK_GETTIME) + * utils.c: Include . Do not include . + (touch): Use `futimens' instead of `utimes'. + * mswindows.h: Do not include . Remove macro definition for mkdir. diff --git a/src/Makefile.am b/src/Makefile.am index 6a3e9947..a7bcbf87 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -37,7 +37,7 @@ endif # The following line is losing on some versions of make! DEFS = @DEFS@ -DSYSTEM_WGETRC=\"$(sysconfdir)/wgetrc\" -DLOCALEDIR=\"$(localedir)\" -LIBS = @LIBICONV@ @LIBINTL@ @LIBS@ +LIBS = @LIBICONV@ @LIBINTL@ @LIBS@ $(LIB_CLOCK_GETTIME) bin_PROGRAMS = wget wget_SOURCES = cmpt.c connect.c convert.c cookies.c ftp.c \ diff --git a/src/utils.c b/src/utils.c index 634e41ff..352cdb7b 100644 --- a/src/utils.c +++ b/src/utils.c @@ -51,8 +51,7 @@ as that of the covered work. */ #include #include -#include - +#include /* For TIOCGWINSZ and friends: */ #ifdef HAVE_SYS_IOCTL_H @@ -488,15 +487,25 @@ fork_to_background (void) void touch (const char *file, time_t tm) { - struct timeval timevals[2]; + struct timespec timespecs[2]; + int fd; - timevals[0].tv_sec = time (NULL); - timevals[0].tv_usec = 0L; - timevals[1].tv_sec = tm; - timevals[1].tv_usec = 0L; + fd = open (file, O_WRONLY); + if (fd < 0) + { + logprintf (LOG_NOTQUIET, "open(%s): %s\n", file, strerror (errno)); + return; + } - if (utimes (file, timevals) == -1) - logprintf (LOG_NOTQUIET, "utimes(%s): %s\n", file, strerror (errno)); + timespecs[0].tv_sec = time (NULL); + 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 diff --git a/tests/ChangeLog b/tests/ChangeLog index 9c853164..1995c826 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +2011-04-19 Giuseppe Scrivano + + * Makefile.am (LIBS): Add $(LIB_CLOCK_GETTIME). + 2011-04-04 Giuseppe Scrivano * Makefile.am (LIBS): Remove @LIBSSL@ @W32LIBS@ diff --git a/tests/Makefile.am b/tests/Makefile.am index c27e3903..ccd274d1 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -34,7 +34,7 @@ PERL = perl PERLRUN = $(PERL) -I$(srcdir) -LIBS = @LIBICONV@ @LIBINTL@ @LIBS@ +LIBS = @LIBICONV@ @LIBINTL@ @LIBS@ $(LIB_CLOCK_GETTIME) .PHONY: test run-unit-tests run-px-tests