summaryrefslogtreecommitdiff
path: root/src/shared/util.c
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2014-05-24 11:39:47 +0800
committerKay Sievers <kay@vrfy.org>2014-05-24 11:39:47 +0800
commit359efc59fdc05e0b9b758b46cf6fb4cfecadbf64 (patch)
treebffe15389c7843c35b52cdde17e678ba148f38b9 /src/shared/util.c
parent82d115d9abf5b2666e5561450fbb17c9044a0b33 (diff)
core: timer - switch to touch_file()
Diffstat (limited to 'src/shared/util.c')
-rw-r--r--src/shared/util.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index 83a674aa8b..0c273943e7 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -3364,17 +3364,17 @@ int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gi
return -errno;
}
- if (uid != (uid_t)-1 || gid != (gid_t)-1) {
+ if (uid != (uid_t) -1 || gid != (gid_t) -1) {
r = fchown(fd, uid, gid);
if (r < 0)
return -errno;
}
- if (stamp != (usec_t)-1) {
+ if (stamp != (usec_t) -1) {
struct timespec ts[2];
timespec_store(&ts[0], stamp);
- timespec_store(&ts[1], stamp);
+ ts[1] = ts[0];
r = futimens(fd, ts);
} else
r = futimens(fd, NULL);
@@ -3385,7 +3385,7 @@ int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gi
}
int touch(const char *path) {
- return touch_file(path, false, -1, -1, -1, 0);
+ return touch_file(path, false, (usec_t) -1, (uid_t) -1, (gid_t) -1, 0);
}
char *unquote(const char *s, const char* quotes) {