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

Use utimes instead of utime.

This commit is contained in:
Giuseppe Scrivano 2011-04-18 14:37:42 +02:00
parent 1eb1e76e9a
commit 179dacd735
2 changed files with 15 additions and 18 deletions

View File

@ -1,5 +1,8 @@
2011-04-18 Giuseppe Scrivano <gscrivano@gnu.org> 2011-04-18 Giuseppe Scrivano <gscrivano@gnu.org>
* utils.c: Include <sys/time.h>. Do not include <sys/utime.h>.
(touch): Use `utimes' instead of `utime'.
* openssl.c (openssl_read): Fix build error. * openssl.c (openssl_read): Fix build error.
2011-04-17 Giuseppe Scrivano <gscrivano@gnu.org> 2011-04-17 Giuseppe Scrivano <gscrivano@gnu.org>

View File

@ -35,9 +35,6 @@ as that of the covered work. */
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#include <unistd.h> #include <unistd.h>
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
# include <sys/mman.h> # include <sys/mman.h>
@ -48,15 +45,15 @@ as that of the covered work. */
#ifdef HAVE_UTIME_H #ifdef HAVE_UTIME_H
# include <utime.h> # include <utime.h>
#endif #endif
#ifdef HAVE_SYS_UTIME_H
# include <sys/utime.h>
#endif
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <assert.h> #include <assert.h>
#include <stdarg.h> #include <stdarg.h>
#include <locale.h> #include <locale.h>
#include <sys/time.h>
/* For TIOCGWINSZ and friends: */ /* For TIOCGWINSZ and friends: */
#ifdef HAVE_SYS_IOCTL_H #ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h> # include <sys/ioctl.h>
@ -491,18 +488,15 @@ fork_to_background (void)
void void
touch (const char *file, time_t tm) touch (const char *file, time_t tm)
{ {
#ifdef HAVE_STRUCT_UTIMBUF struct timeval timevals[2];
struct utimbuf times;
#else timevals[0].tv_sec = time (NULL);
struct { timevals[0].tv_usec = 0L;
time_t actime; timevals[1].tv_sec = tm;
time_t modtime; timevals[1].tv_usec = 0L;
} times;
#endif if (utimes (file, timevals) == -1)
times.modtime = tm; logprintf (LOG_NOTQUIET, "utimes(%s): %s\n", file, strerror (errno));
times.actime = time (NULL);
if (utime (file, &times) == -1)
logprintf (LOG_NOTQUIET, "utime(%s): %s\n", file, strerror (errno));
} }
/* 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