diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-04-09 21:35:07 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-04-09 21:35:07 +0000 |
commit | 3f3aa2a57dc648ade9083f3b3ad83cce8206b912 (patch) | |
tree | d5c648f583bb2edef25f05c2bed303df3d1a61f6 /coreutils/touch.c | |
parent | cd7001f7055c3fc2d6298ab9e3befe91e951c652 (diff) | |
download | busybox-w32-3f3aa2a57dc648ade9083f3b3ad83cce8206b912.tar.gz busybox-w32-3f3aa2a57dc648ade9083f3b3ad83cce8206b912.tar.bz2 busybox-w32-3f3aa2a57dc648ade9083f3b3ad83cce8206b912.zip |
make xfunctions optionally longjump instead of exit.
use it for making NOFORK more practical.
touch: make it a NOFORK applet
Diffstat (limited to 'coreutils/touch.c')
-rw-r--r-- | coreutils/touch.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/coreutils/touch.c b/coreutils/touch.c index ae4e689f1..5f81b2380 100644 --- a/coreutils/touch.c +++ b/coreutils/touch.c | |||
@@ -17,21 +17,16 @@ | |||
17 | * Also, exiting on a failure was a bug. All args should be processed. | 17 | * Also, exiting on a failure was a bug. All args should be processed. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <stdio.h> | ||
21 | #include <sys/types.h> | ||
22 | #include <fcntl.h> | ||
23 | #include <utime.h> | ||
24 | #include <errno.h> | ||
25 | #include <unistd.h> | ||
26 | #include <stdlib.h> | ||
27 | #include "busybox.h" | 20 | #include "busybox.h" |
28 | 21 | ||
22 | /* This is a NOFORK applet. Be very careful! */ | ||
23 | |||
29 | int touch_main(int argc, char **argv); | 24 | int touch_main(int argc, char **argv); |
30 | int touch_main(int argc, char **argv) | 25 | int touch_main(int argc, char **argv) |
31 | { | 26 | { |
32 | int fd; | 27 | int fd; |
33 | int status = EXIT_SUCCESS; | 28 | int status = EXIT_SUCCESS; |
34 | bool flags = (getopt32(argc, argv, "c") & 1); | 29 | int flags = getopt32(argc, argv, "c"); |
35 | 30 | ||
36 | argv += optind; | 31 | argv += optind; |
37 | 32 | ||
@@ -41,7 +36,7 @@ int touch_main(int argc, char **argv) | |||
41 | 36 | ||
42 | do { | 37 | do { |
43 | if (utime(*argv, NULL)) { | 38 | if (utime(*argv, NULL)) { |
44 | if (errno == ENOENT) { /* no such file*/ | 39 | if (errno == ENOENT) { /* no such file */ |
45 | if (flags) { /* Creation is disabled, so ignore. */ | 40 | if (flags) { /* Creation is disabled, so ignore. */ |
46 | continue; | 41 | continue; |
47 | } | 42 | } |