util: make it easy to initialize the crtime from the current time in fd_setcrtime()
This commit is contained in:
parent
dfd1520d3a
commit
d61b600dde
|
@ -2623,7 +2623,7 @@ int journal_file_open(
|
||||||
* attributes are not supported we'll just skip this,
|
* attributes are not supported we'll just skip this,
|
||||||
* and rely solely on mtime/atime/ctime of the file. */
|
* and rely solely on mtime/atime/ctime of the file. */
|
||||||
|
|
||||||
fd_setcrtime(f->fd, now(CLOCK_REALTIME));
|
fd_setcrtime(f->fd, 0);
|
||||||
|
|
||||||
#ifdef HAVE_GCRYPT
|
#ifdef HAVE_GCRYPT
|
||||||
/* Try to load the FSPRG state, and if we can't, then
|
/* Try to load the FSPRG state, and if we can't, then
|
||||||
|
|
|
@ -7670,6 +7670,9 @@ int fd_setcrtime(int fd, usec_t usec) {
|
||||||
|
|
||||||
assert(fd >= 0);
|
assert(fd >= 0);
|
||||||
|
|
||||||
|
if (usec <= 0)
|
||||||
|
usec = now(CLOCK_REALTIME);
|
||||||
|
|
||||||
le = htole64((uint64_t) usec);
|
le = htole64((uint64_t) usec);
|
||||||
if (fsetxattr(fd, "user.crtime_usec", &le, sizeof(le), 0) < 0)
|
if (fsetxattr(fd, "user.crtime_usec", &le, sizeof(le), 0) < 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
Loading…
Reference in a new issue