From: Yu Watanabe Date: Fri, 10 May 2024 01:10:48 +0000 (+0900) Subject: time-util: define TIMESPEC_OMIT X-Git-Tag: v256-rc2~48^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c876cbdd19745a04b23170a56f2f2594ade9b5aa;p=thirdparty%2Fsystemd.git time-util: define TIMESPEC_OMIT Follow-up for 34c3d574742e867ef97e79509e4051a82f1b7d9b. --- diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c index 20329e04c2d..f87de0a2bf5 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 b28ab8242fb..f273770233a 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 4196576daa9..7f7b68f9ff4 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; } }