use utimes() rather than obsolescent utime()
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Sat, 14 Nov 2009 22:35:00 +0000 (23:35 +0100)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Sat, 14 Nov 2009 22:35:00 +0000 (23:35 +0100)
utime is obsolescent in POSIX.1-2008, use utimes() for now.
Untested.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
archival/bbunzip.c
include/libbb.h

index d6625e476e9bf99800577340ffb56a141d0669c6..f81aab81f4950a70c647a23c6e4e4a4eba718d0a 100644 (file)
@@ -105,15 +105,13 @@ int FAST_FUNC bbunpack(char **argv,
                        if (status >= 0) {
                                /* TODO: restore other things? */
                                if (info.mtime) {
-                                       struct utimbuf times;
-
-                                       times.actime = info.mtime;
-                                       times.modtime = info.mtime;
+                                       struct timeval times = {.tv_sec = info.mtime,
+                                                                                       .tv_usec = 0};
                                        /* Note: we closed it first.
                                         * On some systems calling utime
                                         * then closing resets the mtime
                                         * back to current time. */
-                                       utime(new_name, &times); /* ignoring errors */
+                                       utimes(new_name, &times); /* ignoring errors */
                                }
 
                                /* Delete _compressed_ file */
index 0f8973d9e334c34b42c32850dd2d659ec6789817..89d7a7b1b4d1f175800a53f0edc198f7e6fcd122 100644 (file)
@@ -40,7 +40,6 @@
 #include <termios.h>
 #include <time.h>
 #include <unistd.h>
-#include <utime.h>
 /* Try to pull in PATH_MAX */
 #include <limits.h>
 #include <sys/param.h>