time-util: define TIMESPEC_OMIT

Follow-up for 34c3d57474.
This commit is contained in:
Yu Watanabe
2024-05-10 10:10:48 +09:00
parent 41a94ae670
commit c876cbdd19
3 changed files with 4 additions and 2 deletions

View 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)

View 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);

View 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;
}
}