]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
update-done: minor simplification
authorLennart Poettering <lennart@poettering.net>
Mon, 27 Apr 2015 15:22:55 +0000 (17:22 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 27 Apr 2015 15:22:55 +0000 (17:22 +0200)
src/update-done/update-done.c

index 44caf84faf347f2072f2f3bf944f6f7f8202d542..fb7ff988bb3c1ae9362059d05cd5022cf261871f 100644 (file)
         "was updated. See systemd-update-done.service(8).\n"
 
 static int apply_timestamp(const char *path, struct timespec *ts) {
-        struct timespec twice[2];
+        struct timespec twice[2] = {
+                *ts,
+                *ts
+        };
         struct stat st;
 
         assert(path);
@@ -41,9 +44,6 @@ static int apply_timestamp(const char *path, struct timespec *ts) {
                         return 0;
 
                 /* It is older? Then let's update it */
-                twice[0] = *ts;
-                twice[1] = *ts;
-
                 if (utimensat(AT_FDCWD, path, twice, AT_SYMLINK_NOFOLLOW) < 0) {
 
                         if (errno == EROFS)
@@ -74,9 +74,6 @@ static int apply_timestamp(const char *path, struct timespec *ts) {
 
                 (void) loop_write(fd, MESSAGE, strlen(MESSAGE), false);
 
-                twice[0] = *ts;
-                twice[1] = *ts;
-
                 if (futimens(fd, twice) < 0)
                         return log_error_errno(errno, "Failed to update timestamp on %s: %m", path);
         } else