]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fsck.cramfs: fix utimes() usage
authorKarel Zak <kzak@redhat.com>
Tue, 15 Jan 2019 10:44:25 +0000 (11:44 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 15 Jan 2019 10:44:25 +0000 (11:44 +0100)
The bug has been introduced by untested commit ad7ac3d598e2d541d9eba70975e68dff7e52c7d9 ;-(

Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/fsck.cramfs.c

index 76ed303b0eecbf193ddfe9038e686aee3fda0eda..ee9c20ab267f4722bf80112c4c30b08212791116 100644 (file)
@@ -416,10 +416,10 @@ static void do_uncompress(char *path, int outfd, unsigned long offset,
                curr = next;
        } while (size);
 }
-
+#include <utime.h>
 static void change_file_status(char *path, struct cramfs_inode *i)
 {
-       const struct timeval epoch = { 0, 0 };
+       const struct timeval epoch[] = { {0,0}, {0,0} };
 
        if (euid == 0) {
                if (lchown(path, i->uid, i->gid) < 0)
@@ -431,7 +431,7 @@ static void change_file_status(char *path, struct cramfs_inode *i)
        }
        if (S_ISLNK(i->mode))
                return;
-       if (utimes(path, &epoch) < 0)
+       if (utimes(path, epoch) < 0)
                err(FSCK_EX_ERROR, _("utimes failed: %s"), path);
 }