libunarchive: move dpkg-specific things into dpkg.c. 0 byte size differences
[oweals/busybox.git] / archival / bbunzip.c
index d25f5093947dcf307b90a38420005fd90c80a2ba..df674bc6cd43a27839b036d028ca32f9457093f7 100644 (file)
@@ -98,22 +98,22 @@ int FAST_FUNC bbunpack(char **argv,
                status = unpacker(&info);
                if (status < 0)
                        exitcode = 1;
+               xclose(STDOUT_FILENO); /* with error check! */
 
                if (filename) {
                        char *del = new_name;
                        if (status >= 0) {
                                /* TODO: restore other things? */
                                if (info.mtime) {
-                                       struct utimbuf times;
-
-                                       times.actime = info.mtime;
-                                       times.modtime = info.mtime;
-                                       /* Close first.
-                                        * On some systems calling utime
-                                        * then closing resets the mtime. */
-                                       close(STDOUT_FILENO);
-                                       /* Ignoring errors */
-                                       utime(new_name, &times);
+                                       struct timeval times[2];
+
+                                       times[1].tv_sec = times[0].tv_sec = info.mtime;
+                                       times[1].tv_usec = times[0].tv_usec = 0;
+                                       /* Note: we closed it first.
+                                        * On some systems calling utimes
+                                        * then closing resets the mtime
+                                        * back to current time. */
+                                       utimes(new_name, times); /* ignoring errors */
                                }
 
                                /* Delete _compressed_ file */