From c876cbdd19745a04b23170a56f2f2594ade9b5aa Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 10 May 2024 10:10:48 +0900 Subject: [PATCH] time-util: define TIMESPEC_OMIT Follow-up for 34c3d574742e867ef97e79509e4051a82f1b7d9b. --- src/basic/mkdir.c | 2 +- src/basic/time-util.h | 2 ++ src/partition/repart.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c index 20329e04c2..f87de0a2bf 100644 --- a/src/basic/mkdir.c +++ b/src/basic/mkdir.c @@ -259,7 +259,7 @@ int mkdir_p_root_full(const char *root, const char *p, uid_t uid, gid_t gid, mod struct timespec tspec; timespec_store(&tspec, ts); - if (futimens(dfd, (const struct timespec[2]) { { .tv_nsec = UTIME_OMIT }, tspec }) < 0) + if (futimens(dfd, (const struct timespec[2]) { TIMESPEC_OMIT, tspec }) < 0) return -errno; if (futimens(nfd, (const struct timespec[2]) { tspec, tspec }) < 0) diff --git a/src/basic/time-util.h b/src/basic/time-util.h index b28ab8242f..f273770233 100644 --- a/src/basic/time-util.h +++ b/src/basic/time-util.h @@ -75,6 +75,8 @@ typedef enum TimestampStyle { #define DUAL_TIMESTAMP_INFINITY ((dual_timestamp) { USEC_INFINITY, USEC_INFINITY }) #define TRIPLE_TIMESTAMP_NULL ((triple_timestamp) {}) +#define TIMESPEC_OMIT ((const struct timespec) { .tv_nsec = UTIME_OMIT }) + usec_t now(clockid_t clock); nsec_t now_nsec(clockid_t clock); diff --git a/src/partition/repart.c b/src/partition/repart.c index 4196576daa..7f7b68f9ff 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -4936,7 +4936,7 @@ static int do_copy_files(Context *context, Partition *p, const char *root) { struct timespec tspec; timespec_store(&tspec, ts); - if (futimens(pfd, (const struct timespec[2]) { { .tv_nsec = UTIME_OMIT }, tspec }) < 0) + if (futimens(pfd, (const struct timespec[2]) { TIMESPEC_OMIT, tspec }) < 0) return -errno; } }