Skip to content

Commit 0a2f908

Browse files
committed
update-done: minor simplification
1 parent d72bc59 commit 0a2f908

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/update-done/update-done.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828
"was updated. See systemd-update-done.service(8).\n"
2929

3030
static int apply_timestamp(const char *path, struct timespec *ts) {
31-
struct timespec twice[2];
31+
struct timespec twice[2] = {
32+
*ts,
33+
*ts
34+
};
3235
struct stat st;
3336

3437
assert(path);
@@ -41,9 +44,6 @@ static int apply_timestamp(const char *path, struct timespec *ts) {
4144
return 0;
4245

4346
/* It is older? Then let's update it */
44-
twice[0] = *ts;
45-
twice[1] = *ts;
46-
4747
if (utimensat(AT_FDCWD, path, twice, AT_SYMLINK_NOFOLLOW) < 0) {
4848

4949
if (errno == EROFS)
@@ -74,9 +74,6 @@ static int apply_timestamp(const char *path, struct timespec *ts) {
7474

7575
(void) loop_write(fd, MESSAGE, strlen(MESSAGE), false);
7676

77-
twice[0] = *ts;
78-
twice[1] = *ts;
79-
8077
if (futimens(fd, twice) < 0)
8178
return log_error_errno(errno, "Failed to update timestamp on %s: %m", path);
8279
} else

0 commit comments

Comments
 (0)