diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-04-09 21:35:07 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-04-09 21:35:07 +0000 |
commit | d380c416f4b6b1d9d3ca66df11fc69c85ecbee53 (patch) | |
tree | d5c648f583bb2edef25f05c2bed303df3d1a61f6 /coreutils | |
parent | db15f9c96ab5d863a1304ae3a9be06b0bcad08be (diff) | |
download | busybox-w32-d380c416f4b6b1d9d3ca66df11fc69c85ecbee53.tar.gz busybox-w32-d380c416f4b6b1d9d3ca66df11fc69c85ecbee53.tar.bz2 busybox-w32-d380c416f4b6b1d9d3ca66df11fc69c85ecbee53.zip |
make xfunctions optionally longjump instead of exit.
use it for making NOFORK more practical.
touch: make it a NOFORK applet
git-svn-id: svn://busybox.net/trunk/busybox@18376 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/cmp.c | 2 | ||||
-rw-r--r-- | coreutils/touch.c | 13 |
2 files changed, 5 insertions, 10 deletions
diff --git a/coreutils/cmp.c b/coreutils/cmp.c index cff118279..c70f8822d 100644 --- a/coreutils/cmp.c +++ b/coreutils/cmp.c | |||
@@ -30,7 +30,7 @@ static FILE *cmp_xfopen_input(const char * const filename) | |||
30 | fp = fopen_or_warn_stdin(filename); | 30 | fp = fopen_or_warn_stdin(filename); |
31 | if (fp) | 31 | if (fp) |
32 | return fp; | 32 | return fp; |
33 | exit(xfunc_error_retval); /* We already output an error message. */ | 33 | sleep_and_die(); /* We already output an error message. */ |
34 | } | 34 | } |
35 | 35 | ||
36 | static const char fmt_eof[] = "cmp: EOF on %s\n"; | 36 | static const char fmt_eof[] = "cmp: EOF on %s\n"; |
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 | } |