]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fsck.cramfs: use utimes() instead of utime() that is obsolete
authorSami Kerola <kerolasa@iki.fi>
Mon, 7 Jan 2019 22:23:04 +0000 (22:23 +0000)
committerSami Kerola <kerolasa@iki.fi>
Sat, 12 Jan 2019 08:46:54 +0000 (08:46 +0000)
Reference: http://man7.org/linux/man-pages/man3/utime.3p.html#APPLICATION_USAGE
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
disk-utils/fsck.cramfs.c

index 0d9bdadf779f25846888b34337d49ac83c6977ee..76ed303b0eecbf193ddfe9038e686aee3fda0eda 100644 (file)
@@ -42,7 +42,6 @@
 #include <errno.h>
 #include <string.h>
 #include <getopt.h>
-#include <utime.h>
 #include <fcntl.h>
 
 /* We don't use our include/crc32.h, but crc32 from zlib!
@@ -52,6 +51,7 @@
  */
 #include <zlib.h>
 
+#include <sys/time.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/mman.h>
@@ -419,7 +419,7 @@ static void do_uncompress(char *path, int outfd, unsigned long offset,
 
 static void change_file_status(char *path, struct cramfs_inode *i)
 {
-       struct utimbuf epoch = { 0, 0 };
+       const struct timeval epoch = { 0, 0 };
 
        if (euid == 0) {
                if (lchown(path, i->uid, i->gid) < 0)
@@ -431,8 +431,8 @@ static void change_file_status(char *path, struct cramfs_inode *i)
        }
        if (S_ISLNK(i->mode))
                return;
-       if (utime(path, &epoch) < 0)
-               err(FSCK_EX_ERROR, _("utime failed: %s"), path);
+       if (utimes(path, &epoch) < 0)
+               err(FSCK_EX_ERROR, _("utimes failed: %s"), path);
 }
 
 static void do_directory(char *path, struct cramfs_inode *i)