aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2007-11-15 20:43:35 -0600
committerRob Landley <rob@landley.net>2007-11-15 20:43:35 -0600
commit00ee268e3a4c677bb46c0c0b8f97038a7f2699d8 (patch)
treee0f3d3bbab9b7a636f14f5f6cd3fd81c6e09913d /toys
parent627dc77bb6749dbb2cb41d2bbca0c8e41c7504ca (diff)
downloadtoybox-00ee268e3a4c677bb46c0c0b8f97038a7f2699d8.tar.gz
Simplify touch -l slightly.
Diffstat (limited to 'toys')
-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: