mirror of
https://github.com/sheumann/hush.git
synced 2024-08-21 11:28:57 +00:00
use utimes() rather than obsolescent utime()
utime is obsolescent in POSIX.1-2008, use utimes() for now. Untested. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
This commit is contained in:
parent
e3600a042e
commit
cc8b6871a7
@ -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, ×); /* ignoring errors */
|
||||
utimes(new_name, ×); /* ignoring errors */
|
||||
}
|
||||
|
||||
/* Delete _compressed_ 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>
|
||||
|
Loading…
Reference in New Issue
Block a user