aboutsummaryrefslogtreecommitdiff
path: root/toys/touch.c
diff options
context:
space:
mode:
Diffstat (limited to 'toys/touch.c')
-rw-r--r--toys/touch.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/toys/touch.c b/toys/touch.c
index 514ee1be..a06204ac 100644
--- a/toys/touch.c
+++ b/toys/touch.c
@@ -25,17 +25,11 @@ int touch_main(void)
char *arg;
int i, set_a, set_m, create;
time_t curr_a, curr_m;
- off_t length;
set_a = !!(toys.optflags & ATIME);
set_m = !!(toys.optflags & MTIME);
create = !(toys.optflags & NO_CREATE);
- if (toys.optflags & LENGTH)
- length = toy.touch.length;
- else
- length = -1;
-
if (toys.optflags & REFERENCE) {
struct stat sb;
if (toys.optflags & TIME)
@@ -86,8 +80,8 @@ time_error:
buf.actime = sb.st_atime;
}
- if (length != -1)
- if (truncate(arg, length))
+ if (toys.optflags & LENGTH)
+ if (truncate(arg, toy.touch.length))
goto error;
if (utime(arg, &buf))
error: