summaryrefslogtreecommitdiffhomepage
path: root/coreutils/touch.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-08-15 20:23:40 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2021-08-15 20:23:40 +0200
commitac2d4d88ce54d418b579a50ae18434fbf5ffa58a (patch)
treebe73987408ddcf5d0e2447e4df3b87bde423507d /coreutils/touch.c
parenteaa8ee40aa049040e9f9bb1d967754102742c227 (diff)
touch: fix SEGV if !ENABLE_FEATURE_TOUCH_SUSV3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/touch.c')
-rw-r--r--coreutils/touch.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/coreutils/touch.c b/coreutils/touch.c
index ec12eb7cf..78100ba1d 100644
--- a/coreutils/touch.c
+++ b/coreutils/touch.c
@@ -127,6 +127,7 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
#endif
);
+#if ENABLE_FEATURE_TOUCH_SUSV3
timebuf[0].tv_nsec = timebuf[1].tv_nsec = UTIME_NOW;
if (opts & OPT_r) {
struct stat stbuf;
@@ -160,6 +161,7 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
timebuf[1].tv_nsec = UTIME_OMIT;
if ((opts & (OPT_a|OPT_m)) == OPT_m)
timebuf[0].tv_nsec = UTIME_OMIT;
+#endif
argv += optind;
do {