From: Giuseppe Scrivano Date: Mon, 18 Apr 2011 12:37:42 +0000 (+0200) Subject: Use utimes instead of utime. X-Git-Tag: v1.13~37 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=179dacd7350cef30f0de730cc54647baaf95a6c3 Use utimes instead of utime. --- diff --git a/src/ChangeLog b/src/ChangeLog index 07c99b97..53db6608 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-04-18 Giuseppe Scrivano + * utils.c: Include . Do not include . + (touch): Use `utimes' instead of `utime'. + * openssl.c (openssl_read): Fix build error. 2011-04-17 Giuseppe Scrivano diff --git a/src/utils.c b/src/utils.c index 86f4e122..634e41ff 100644 --- a/src/utils.c +++ b/src/utils.c @@ -35,9 +35,6 @@ as that of the covered work. */ #include #include #include -#ifdef HAVE_SYS_TIME_H -# include -#endif #include #ifdef HAVE_MMAP # include @@ -48,15 +45,15 @@ as that of the covered work. */ #ifdef HAVE_UTIME_H # include #endif -#ifdef HAVE_SYS_UTIME_H -# include -#endif #include #include #include #include #include +#include + + /* For TIOCGWINSZ and friends: */ #ifdef HAVE_SYS_IOCTL_H # include @@ -491,18 +488,15 @@ fork_to_background (void) void touch (const char *file, time_t tm) { -#ifdef HAVE_STRUCT_UTIMBUF - struct utimbuf times; -#else - struct { - time_t actime; - time_t modtime; - } times; -#endif - times.modtime = tm; - times.actime = time (NULL); - if (utime (file, ×) == -1) - logprintf (LOG_NOTQUIET, "utime(%s): %s\n", file, strerror (errno)); + struct timeval timevals[2]; + + timevals[0].tv_sec = time (NULL); + timevals[0].tv_usec = 0L; + timevals[1].tv_sec = tm; + timevals[1].tv_usec = 0L; + + if (utimes (file, timevals) == -1) + logprintf (LOG_NOTQUIET, "utimes(%s): %s\n", file, strerror (errno)); } /* Checks if FILE is a symbolic link, and removes it if it is. Does