aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-11-29 19:40:36 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2009-11-29 19:40:36 +0100
commitdcbfaba264df2f9f07e53f77e8178f5bfc7ae88e (patch)
treeb5dfaa3715ded4f3c9a676b6cf636ad50bf04c9d /archival
parentbf22475e9552b08feb31d40250ab293d2fd98234 (diff)
downloadbusybox-w32-dcbfaba264df2f9f07e53f77e8178f5bfc7ae88e.tar.gz
busybox-w32-dcbfaba264df2f9f07e53f77e8178f5bfc7ae88e.tar.bz2
busybox-w32-dcbfaba264df2f9f07e53f77e8178f5bfc7ae88e.zip
fix improper utimes usage
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival')
-rw-r--r--archival/bbunzip.c8
-rw-r--r--archival/libunarchive/data_extract_all.c8
2 files changed, 8 insertions, 8 deletions
diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index 22a0fd189..df674bc6c 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -105,15 +105,15 @@ int FAST_FUNC bbunpack(char **argv,
105 if (status >= 0) { 105 if (status >= 0) {
106 /* TODO: restore other things? */ 106 /* TODO: restore other things? */
107 if (info.mtime) { 107 if (info.mtime) {
108 struct timeval times; 108 struct timeval times[2];
109 109
110 times.tv_sec = info.mtime; 110 times[1].tv_sec = times[0].tv_sec = info.mtime;
111 times.tv_usec = 0; 111 times[1].tv_usec = times[0].tv_usec = 0;
112 /* Note: we closed it first. 112 /* Note: we closed it first.
113 * On some systems calling utimes 113 * On some systems calling utimes
114 * then closing resets the mtime 114 * then closing resets the mtime
115 * back to current time. */ 115 * back to current time. */
116 utimes(new_name, &times); /* ignoring errors */ 116 utimes(new_name, times); /* ignoring errors */
117 } 117 }
118 118
119 /* Delete _compressed_ file */ 119 /* Delete _compressed_ file */
diff --git a/archival/libunarchive/data_extract_all.c b/archival/libunarchive/data_extract_all.c
index 1100410e6..ae242df64 100644
--- a/archival/libunarchive/data_extract_all.c
+++ b/archival/libunarchive/data_extract_all.c
@@ -148,11 +148,11 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle)
148 } 148 }
149 /* same for utime */ 149 /* same for utime */
150 if (archive_handle->ah_flags & ARCHIVE_RESTORE_DATE) { 150 if (archive_handle->ah_flags & ARCHIVE_RESTORE_DATE) {
151 struct timeval t; 151 struct timeval t[2];
152 152
153 t.tv_sec = file_header->mtime; 153 t[1].tv_sec = t[0].tv_sec = file_header->mtime;
154 t.tv_usec = 0; 154 t[1].tv_usec = t[0].tv_usec = 0;
155 utimes(file_header->name, &t); 155 utimes(file_header->name, t);
156 } 156 }
157 } 157 }
158} 158}