]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
time-util: define TIMESPEC_OMIT
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 10 May 2024 01:10:48 +0000 (10:10 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 10 May 2024 01:11:06 +0000 (10:11 +0900)
Follow-up for 34c3d574742e867ef97e79509e4051a82f1b7d9b.

src/basic/mkdir.c
src/basic/time-util.h
src/partition/repart.c

index 20329e04c2dba17745352c67d35b6c0ea5f4f6e1..f87de0a2bf58b993bfb885f74b5e5a00c1778d45 100644 (file)
@@ -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)
index b28ab8242fb203f87f9ef4aa306a388521f1aa1d..f273770233ad9b6db3b2b177de703f4456ffb598 100644 (file)
@@ -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);
 
index 4196576daa97534f9e52b6eb808c79d650365801..7f7b68f9ff4741fcfe1b895cc99a526f43526773 100644 (file)
@@ -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;
                         }
                 }