about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2016-04-27 16:50:32 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2016-04-27 16:50:32 +0000
commit2a347314368713573aa6a9785089bd7cc8009dc6 (patch)
tree7e4048da144a623be37af540f7f532f58c9d9218 /src
parent6fa4f688af8c0835acbf8fa7a92cda906096c15b (diff)
downloads6-portable-utils-2a347314368713573aa6a9785089bd7cc8009dc6.tar.gz
s6-portable-utils-2a347314368713573aa6a9785089bd7cc8009dc6.tar.xz
s6-portable-utils-2a347314368713573aa6a9785089bd7cc8009dc6.zip
Use skalibs touch() in s6-touch for more portability
Diffstat (limited to 'src')
-rw-r--r--src/skaembutils/s6-touch.c12
1 files changed, 1 insertions, 11 deletions
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 <sys/types.h>
-#include <sys/stat.h>
-#include <time.h>
 #include <skalibs/strerr2.h>
 #include <skalibs/djbunix.h>
 
@@ -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 ;
 }