From 2a347314368713573aa6a9785089bd7cc8009dc6 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Wed, 27 Apr 2016 16:50:32 +0000 Subject: Use skalibs touch() in s6-touch for more portability --- src/skaembutils/s6-touch.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'src/skaembutils') diff --git a/src/skaembutils/s6-touch.c b/src/skaembutils/s6-touch.c index ca5bdd0..5b90987 100644 --- a/src/skaembutils/s6-touch.c +++ b/src/skaembutils/s6-touch.c @@ -1,8 +1,5 @@ /* ISC license. */ -#include -#include -#include #include #include @@ -10,16 +7,9 @@ int main (int argc, char const *const *argv) { - static struct timespec const now2[2] = { { .tv_sec = 0, .tv_nsec = UTIME_NOW }, { .tv_sec = 0, .tv_nsec = UTIME_NOW } } ; char const *const *p = argv + 1 ; PROG = "s6-touch" ; if (argc < 2) strerr_dieusage(100, USAGE) ; - for (; *p ; p++) - { - register int fd = open_append(*p) ; - if (fd < 0) strerr_diefu2sys(111, "open_append ", *p) ; - if (futimens(fd, now2) < 0) strerr_diefu2sys(111, "futimens ", *p) ; - fd_close(fd) ; - } + for (; *p ; p++) if (!touch(*p)) strerr_diefu2sys(111, "touch ", *p) ; return 0 ; } -- cgit v1.2.3