[git commit master] use utimes() rather than obsolescent utime()

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Sat Nov 14 22:35:00 UTC 2009


commit: http://git.busybox.net/busybox/commit/?id=cc8b6871a71e42a3e0bdb79e534b90cc3eb4c8e6
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

utime is obsolescent in POSIX.1-2008, use utimes() for now.
Untested.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
 archival/bbunzip.c |    8 +++-----
 include/libbb.h    |    1 -
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index d6625e4..f81aab8 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -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 */
diff --git a/include/libbb.h b/include/libbb.h
index 0f8973d..89d7a7b 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -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>
-- 
1.6.3.3



More information about the busybox-cvs mailing list