aboutsummaryrefslogtreecommitdiff
path: root/coreutils/sleep.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-04-10 15:43:37 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-04-10 15:43:37 +0000
commit99912ca733dd960f5589227fd999c86e73c8e894 (patch)
tree9df947fc08884d498cf76a02204d74b121064134 /coreutils/sleep.c
parentff131b980d524a33d8a43cefe65e14f64a43f2da (diff)
downloadbusybox-w32-99912ca733dd960f5589227fd999c86e73c8e894.tar.gz
busybox-w32-99912ca733dd960f5589227fd999c86e73c8e894.tar.bz2
busybox-w32-99912ca733dd960f5589227fd999c86e73c8e894.zip
audit small applets and mark some of them as NOFORK.
Put big scary warnings in relevant places.
Diffstat (limited to 'coreutils/sleep.c')
-rw-r--r--coreutils/sleep.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/coreutils/sleep.c b/coreutils/sleep.c
index b89b0fe9c..592005bab 100644
--- a/coreutils/sleep.c
+++ b/coreutils/sleep.c
@@ -18,12 +18,12 @@
18 * time suffixes for seconds, minutes, hours, and days. 18 * time suffixes for seconds, minutes, hours, and days.
19 */ 19 */
20 20
21#include <stdlib.h>
22#include <limits.h>
23#include <unistd.h>
24#include "busybox.h" 21#include "busybox.h"
25 22
26#ifdef CONFIG_FEATURE_FANCY_SLEEP 23/* This is a NOFORK applet. Be very careful! */
24
25
26#if ENABLE_FEATURE_FANCY_SLEEP
27static const struct suffix_mult sfx[] = { 27static const struct suffix_mult sfx[] = {
28 { "s", 1 }, 28 { "s", 1 },
29 { "m", 60 }, 29 { "m", 60 },
@@ -36,9 +36,9 @@ static const struct suffix_mult sfx[] = {
36int sleep_main(int argc, char **argv); 36int sleep_main(int argc, char **argv);
37int sleep_main(int argc, char **argv) 37int sleep_main(int argc, char **argv)
38{ 38{
39 unsigned int duration; 39 unsigned duration;
40 40
41#ifdef CONFIG_FEATURE_FANCY_SLEEP 41#if ENABLE_FEATURE_FANCY_SLEEP
42 42
43 if (argc < 2) { 43 if (argc < 2) {
44 bb_show_usage(); 44 bb_show_usage();
@@ -50,7 +50,7 @@ int sleep_main(int argc, char **argv)
50 duration += xatoul_range_sfx(*argv, 0, UINT_MAX-duration, sfx); 50 duration += xatoul_range_sfx(*argv, 0, UINT_MAX-duration, sfx);
51 } while (*++argv); 51 } while (*++argv);
52 52
53#else /* CONFIG_FEATURE_FANCY_SLEEP */ 53#else /* FEATURE_FANCY_SLEEP */
54 54
55 if (argc != 2) { 55 if (argc != 2) {
56 bb_show_usage(); 56 bb_show_usage();
@@ -58,7 +58,7 @@ int sleep_main(int argc, char **argv)
58 58
59 duration = xatou(argv[1]); 59 duration = xatou(argv[1]);
60 60
61#endif /* CONFIG_FEATURE_FANCY_SLEEP */ 61#endif /* FEATURE_FANCY_SLEEP */
62 62
63 if (sleep(duration)) { 63 if (sleep(duration)) {
64 bb_perror_nomsg_and_die(); 64 bb_perror_nomsg_and_die();