audit small applets and mark some of them as NOFORK.
Put big scary warnings in relevant places.
This commit is contained in:
@ -18,12 +18,12 @@
|
||||
* time suffixes for seconds, minutes, hours, and days.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <unistd.h>
|
||||
#include "busybox.h"
|
||||
|
||||
#ifdef CONFIG_FEATURE_FANCY_SLEEP
|
||||
/* This is a NOFORK applet. Be very careful! */
|
||||
|
||||
|
||||
#if ENABLE_FEATURE_FANCY_SLEEP
|
||||
static const struct suffix_mult sfx[] = {
|
||||
{ "s", 1 },
|
||||
{ "m", 60 },
|
||||
@ -36,9 +36,9 @@ static const struct suffix_mult sfx[] = {
|
||||
int sleep_main(int argc, char **argv);
|
||||
int sleep_main(int argc, char **argv)
|
||||
{
|
||||
unsigned int duration;
|
||||
unsigned duration;
|
||||
|
||||
#ifdef CONFIG_FEATURE_FANCY_SLEEP
|
||||
#if ENABLE_FEATURE_FANCY_SLEEP
|
||||
|
||||
if (argc < 2) {
|
||||
bb_show_usage();
|
||||
@ -50,7 +50,7 @@ int sleep_main(int argc, char **argv)
|
||||
duration += xatoul_range_sfx(*argv, 0, UINT_MAX-duration, sfx);
|
||||
} while (*++argv);
|
||||
|
||||
#else /* CONFIG_FEATURE_FANCY_SLEEP */
|
||||
#else /* FEATURE_FANCY_SLEEP */
|
||||
|
||||
if (argc != 2) {
|
||||
bb_show_usage();
|
||||
@ -58,7 +58,7 @@ int sleep_main(int argc, char **argv)
|
||||
|
||||
duration = xatou(argv[1]);
|
||||
|
||||
#endif /* CONFIG_FEATURE_FANCY_SLEEP */
|
||||
#endif /* FEATURE_FANCY_SLEEP */
|
||||
|
||||
if (sleep(duration)) {
|
||||
bb_perror_nomsg_and_die();
|
||||
|
Reference in New Issue
Block a user