summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-01-08 01:27:13 +0100
committerLennart Poettering <lennart@poettering.net>2015-01-08 01:27:13 +0100
commitd61b600dde1f267a408440011aa980e0ed44bea6 (patch)
tree2b0d6f71fd19144df3d718fc251a78ab0a4c1897 /src/shared
parentdfd1520d3ab98cfa376f2d84ed1e7887d013720d (diff)
util: make it easy to initialize the crtime from the current time in fd_setcrtime()
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/util.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index 88fd78ec8d..7d753e448a 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -7670,6 +7670,9 @@ int fd_setcrtime(int fd, usec_t usec) {
assert(fd >= 0);
+ if (usec <= 0)
+ usec = now(CLOCK_REALTIME);
+
le = htole64((uint64_t) usec);
if (fsetxattr(fd, "user.crtime_usec", &le, sizeof(le), 0) < 0)
return -errno;