From ac2d4d88ce54d418b579a50ae18434fbf5ffa58a Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 15 Aug 2021 20:23:40 +0200 Subject: [PATCH] touch: fix SEGV if !ENABLE_FEATURE_TOUCH_SUSV3 Signed-off-by: Denys Vlasenko --- coreutils/touch.c | 2 ++ 1 file changed, 2 insertions(+) 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 {