- use EXIT_{SUCCESS,FAILURE}. No object-code changes
This commit is contained in:
parent
cb83abd7b6
commit
636a1f85e8
@ -22,5 +22,5 @@ void bb_show_usage(void)
|
|||||||
{
|
{
|
||||||
printf(APPLET_full_usage "\n");
|
printf(APPLET_full_usage "\n");
|
||||||
|
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ char get_header_tar(archive_handle_t *archive_handle)
|
|||||||
* "tar: A lone zero block at N", where N = kilobyte
|
* "tar: A lone zero block at N", where N = kilobyte
|
||||||
* where EOF was met (not EOF block, actual EOF!),
|
* where EOF was met (not EOF block, actual EOF!),
|
||||||
* and tar will exit with error code 0.
|
* and tar will exit with error code 0.
|
||||||
* We will mimic exit(0), although we will not mimic
|
* We will mimic exit(EXIT_SUCCESS), although we will not mimic
|
||||||
* the message and we don't check whether we indeed
|
* the message and we don't check whether we indeed
|
||||||
* saw zero block directly before this. */
|
* saw zero block directly before this. */
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
|
@ -40,7 +40,7 @@ int open_transformer(int src_fd,
|
|||||||
close(fd_pipe.wr); /* Send EOF */
|
close(fd_pipe.wr); /* Send EOF */
|
||||||
close(src_fd);
|
close(src_fd);
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
char *argv[4];
|
char *argv[4];
|
||||||
|
@ -552,7 +552,7 @@ static void NOINLINE vfork_compressor(int tar_fd, int gzip)
|
|||||||
/* exec gzip/bzip2 program/applet */
|
/* exec gzip/bzip2 program/applet */
|
||||||
BB_EXECLP(zip_exec, zip_exec, "-f", NULL);
|
BB_EXECLP(zip_exec, zip_exec, "-f", NULL);
|
||||||
vfork_exec_errno = errno;
|
vfork_exec_errno = errno;
|
||||||
_exit(1);
|
_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parent */
|
/* parent */
|
||||||
|
@ -17,7 +17,7 @@ static void
|
|||||||
onintr(int sig ATTRIBUTE_UNUSED)
|
onintr(int sig ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
tcsetattr(STDERR_FILENO, TCSANOW, &old_termios);
|
tcsetattr(STDERR_FILENO, TCSANOW, &old_termios);
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int resize_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int resize_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
|
@ -179,7 +179,7 @@ int cal_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fflush_stdout_and_exit(0);
|
fflush_stdout_and_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -85,7 +85,7 @@ int env_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
puts(*ep);
|
puts(*ep);
|
||||||
}
|
}
|
||||||
|
|
||||||
fflush_stdout_and_exit(0);
|
fflush_stdout_and_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -29,5 +29,5 @@ int printenv_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fflush_stdout_and_exit(0);
|
fflush_stdout_and_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ static char **print_formatted(char *format, char **argv)
|
|||||||
break;
|
break;
|
||||||
case '\\':
|
case '\\':
|
||||||
if (*++f == 'c')
|
if (*++f == 'c')
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
bb_putchar(bb_process_escape_sequence((const char **)&f));
|
bb_putchar(bb_process_escape_sequence((const char **)&f));
|
||||||
f--;
|
f--;
|
||||||
break;
|
break;
|
||||||
|
@ -403,7 +403,7 @@ int start_stop_daemon_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
/* parent */
|
/* parent */
|
||||||
/* why _exit? the child may have changed the stack,
|
/* why _exit? the child may have changed the stack,
|
||||||
* so "return 0" may do bad things */
|
* so "return 0" may do bad things */
|
||||||
_exit(0);
|
_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
/* child */
|
/* child */
|
||||||
setsid(); /* detach from controlling tty */
|
setsid(); /* detach from controlling tty */
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
enum {
|
enum {
|
||||||
OPTBIT_l, /* list matched file names only */
|
OPTBIT_l, /* list matched file names only */
|
||||||
OPTBIT_n, /* print line# */
|
OPTBIT_n, /* print line# */
|
||||||
OPTBIT_q, /* quiet - exit(0) of first match */
|
OPTBIT_q, /* quiet - exit(EXIT_SUCCESS) of first match */
|
||||||
OPTBIT_v, /* invert the match, to select non-matching lines */
|
OPTBIT_v, /* invert the match, to select non-matching lines */
|
||||||
OPTBIT_s, /* suppress errors about file open errors */
|
OPTBIT_s, /* suppress errors about file open errors */
|
||||||
OPTBIT_c, /* count matches per file (suppresses normal output) */
|
OPTBIT_c, /* count matches per file (suppresses normal output) */
|
||||||
@ -224,7 +224,7 @@ static int grep_file(FILE *file)
|
|||||||
* "exit immediately with zero status
|
* "exit immediately with zero status
|
||||||
* if any match is found,
|
* if any match is found,
|
||||||
* even if errors were detected" */
|
* even if errors were detected" */
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
/* if we're just printing filenames, we stop after the first match */
|
/* if we're just printing filenames, we stop after the first match */
|
||||||
if (PRINT_FILES_WITH_MATCHES) {
|
if (PRINT_FILES_WITH_MATCHES) {
|
||||||
|
@ -517,7 +517,7 @@ void bb_show_usage(void)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "Usage: %s [-p] [-r] [-t] -[x] [-n max_arg] [-s max_chars]\n",
|
fprintf(stderr, "Usage: %s [-p] [-r] [-t] -[x] [-n max_arg] [-s max_chars]\n",
|
||||||
applet_name);
|
applet_name);
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
|
20
init/init.c
20
init/init.c
@ -301,7 +301,7 @@ static void open_stdio_to_tty(const char* tty_name, int exit_on_failure)
|
|||||||
message(L_LOG | L_CONSOLE, "Can't open %s: %s",
|
message(L_LOG | L_CONSOLE, "Can't open %s: %s",
|
||||||
tty_name, strerror(errno));
|
tty_name, strerror(errno));
|
||||||
if (exit_on_failure)
|
if (exit_on_failure)
|
||||||
_exit(1);
|
_exit(EXIT_FAILURE);
|
||||||
if (ENABLE_DEBUG_INIT)
|
if (ENABLE_DEBUG_INIT)
|
||||||
_exit(2);
|
_exit(2);
|
||||||
/* NB: we don't reach this if we were called after vfork.
|
/* NB: we don't reach this if we were called after vfork.
|
||||||
@ -415,7 +415,7 @@ static pid_t run(const struct init_action *a)
|
|||||||
pid = fork();
|
pid = fork();
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
message(L_LOG | L_CONSOLE, "Can't fork");
|
message(L_LOG | L_CONSOLE, "Can't fork");
|
||||||
_exit(1);
|
_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pid > 0) {
|
if (pid > 0) {
|
||||||
@ -430,21 +430,21 @@ static pid_t run(const struct init_action *a)
|
|||||||
waitfor(pid);
|
waitfor(pid);
|
||||||
/* See if stealing the controlling tty back is necessary */
|
/* See if stealing the controlling tty back is necessary */
|
||||||
if (tcgetpgrp(0) != getpid())
|
if (tcgetpgrp(0) != getpid())
|
||||||
_exit(0);
|
_exit(EXIT_SUCCESS);
|
||||||
|
|
||||||
/* Use a temporary process to steal the controlling tty. */
|
/* Use a temporary process to steal the controlling tty. */
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
message(L_LOG | L_CONSOLE, "Can't fork");
|
message(L_LOG | L_CONSOLE, "Can't fork");
|
||||||
_exit(1);
|
_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
setsid();
|
setsid();
|
||||||
ioctl(0, TIOCSCTTY, 1);
|
ioctl(0, TIOCSCTTY, 1);
|
||||||
_exit(0);
|
_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
waitfor(pid);
|
waitfor(pid);
|
||||||
_exit(0);
|
_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Child - fall though to actually execute things */
|
/* Child - fall though to actually execute things */
|
||||||
@ -531,13 +531,13 @@ static void run_actions(int action_type)
|
|||||||
static void init_reboot(unsigned long magic)
|
static void init_reboot(unsigned long magic)
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
/* We have to fork here, since the kernel calls do_exit(0) in
|
/* We have to fork here, since the kernel calls do_exit(EXIT_SUCCESS) in
|
||||||
* linux/kernel/sys.c, which can cause the machine to panic when
|
* linux/kernel/sys.c, which can cause the machine to panic when
|
||||||
* the init process is killed.... */
|
* the init process is killed.... */
|
||||||
pid = vfork();
|
pid = vfork();
|
||||||
if (pid == 0) { /* child */
|
if (pid == 0) { /* child */
|
||||||
reboot(magic);
|
reboot(magic);
|
||||||
_exit(0);
|
_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
waitfor(pid);
|
waitfor(pid);
|
||||||
}
|
}
|
||||||
@ -821,7 +821,7 @@ static void reload_signal(int sig ATTRIBUTE_UNUSED)
|
|||||||
kill(pid, SIGKILL);
|
kill(pid, SIGKILL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_exit(0);
|
_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -936,7 +936,7 @@ int init_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
/* SELinux in enforcing mode but load_policy failed */
|
/* SELinux in enforcing mode but load_policy failed */
|
||||||
message(L_CONSOLE, "Cannot load SELinux Policy. "
|
message(L_CONSOLE, "Cannot load SELinux Policy. "
|
||||||
"Machine is in enforcing mode. Halting now.");
|
"Machine is in enforcing mode. Halting now.");
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_SELINUX */
|
#endif /* CONFIG_SELINUX */
|
||||||
|
@ -89,7 +89,7 @@ void kill_myself_with_sig(int sig)
|
|||||||
signal(sig, SIG_DFL);
|
signal(sig, SIG_DFL);
|
||||||
sig_unblock(sig);
|
sig_unblock(sig);
|
||||||
raise(sig);
|
raise(sig);
|
||||||
_exit(1); /* Should not reach it */
|
_exit(EXIT_FAILURE); /* Should not reach it */
|
||||||
}
|
}
|
||||||
|
|
||||||
void signal_SA_RESTART_empty_mask(int sig, void (*handler)(int))
|
void signal_SA_RESTART_empty_mask(int sig, void (*handler)(int))
|
||||||
|
@ -230,7 +230,7 @@ void forkexit_or_rexec(char **argv)
|
|||||||
if (pid < 0) /* wtf? */
|
if (pid < 0) /* wtf? */
|
||||||
bb_perror_msg_and_die("vfork");
|
bb_perror_msg_and_die("vfork");
|
||||||
if (pid) /* parent */
|
if (pid) /* parent */
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
/* child - re-exec ourself */
|
/* child - re-exec ourself */
|
||||||
re_exec(argv);
|
re_exec(argv);
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@ void forkexit_or_rexec(void)
|
|||||||
if (pid < 0) /* wtf? */
|
if (pid < 0) /* wtf? */
|
||||||
bb_perror_msg_and_die("fork");
|
bb_perror_msg_and_die("fork");
|
||||||
if (pid) /* parent */
|
if (pid) /* parent */
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
/* child */
|
/* child */
|
||||||
}
|
}
|
||||||
#define forkexit_or_rexec(argv) forkexit_or_rexec()
|
#define forkexit_or_rexec(argv) forkexit_or_rexec()
|
||||||
|
@ -423,7 +423,7 @@ static char *get_logname(char *logname, unsigned size_logname,
|
|||||||
/* Do not report trivial EINTR/EIO errors. */
|
/* Do not report trivial EINTR/EIO errors. */
|
||||||
if (read(0, &c, 1) < 1) {
|
if (read(0, &c, 1) < 1) {
|
||||||
if (errno == EINTR || errno == EIO)
|
if (errno == EINTR || errno == EIO)
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
bb_perror_msg_and_die("%s: read", op->tty);
|
bb_perror_msg_and_die("%s: read", op->tty);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -475,7 +475,7 @@ static char *get_logname(char *logname, unsigned size_logname,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CTL('D'):
|
case CTL('D'):
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
default:
|
default:
|
||||||
if (!isascii(ascval) || !isprint(ascval)) {
|
if (!isascii(ascval) || !isprint(ascval)) {
|
||||||
/* ignore garbage characters */
|
/* ignore garbage characters */
|
||||||
|
@ -130,7 +130,7 @@ static void die_if_nologin(void)
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
} else
|
} else
|
||||||
puts("\r\nSystem closed for routine maintenance\r");
|
puts("\r\nSystem closed for routine maintenance\r");
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static ALWAYS_INLINE void die_if_nologin(void) {}
|
static ALWAYS_INLINE void die_if_nologin(void) {}
|
||||||
@ -178,18 +178,18 @@ static void get_username_or_die(char *buf, int size_buf)
|
|||||||
/* skip whitespace */
|
/* skip whitespace */
|
||||||
do {
|
do {
|
||||||
c = getchar();
|
c = getchar();
|
||||||
if (c == EOF) exit(1);
|
if (c == EOF) exit(EXIT_FAILURE);
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
if (!--cntdown) exit(1);
|
if (!--cntdown) exit(EXIT_FAILURE);
|
||||||
goto prompt;
|
goto prompt;
|
||||||
}
|
}
|
||||||
} while (isspace(c));
|
} while (isspace(c));
|
||||||
|
|
||||||
*buf++ = c;
|
*buf++ = c;
|
||||||
if (!fgets(buf, size_buf-2, stdin))
|
if (!fgets(buf, size_buf-2, stdin))
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
if (!strchr(buf, '\n'))
|
if (!strchr(buf, '\n'))
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
while (isgraph(*buf)) buf++;
|
while (isgraph(*buf)) buf++;
|
||||||
*buf = '\0';
|
*buf = '\0';
|
||||||
}
|
}
|
||||||
|
@ -102,5 +102,5 @@ int vlock_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
|
|
||||||
ioctl(STDIN_FILENO, VT_SETMODE, &ovtm);
|
ioctl(STDIN_FILENO, VT_SETMODE, &ovtm);
|
||||||
tcsetattr(STDIN_FILENO, TCSANOW, &oterm);
|
tcsetattr(STDIN_FILENO, TCSANOW, &oterm);
|
||||||
fflush_stdout_and_exit(0);
|
fflush_stdout_and_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -797,7 +797,7 @@ ForkJob(const char *user, CronLine *line, int mailFd,
|
|||||||
if (mail_filename) {
|
if (mail_filename) {
|
||||||
fdprintf(1, "Exec failed: %s -c %s\n", prog, arg);
|
fdprintf(1, "Exec failed: %s -c %s\n", prog, arg);
|
||||||
}
|
}
|
||||||
_exit(0);
|
_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
line->cl_Pid = pid;
|
line->cl_Pid = pid;
|
||||||
@ -930,7 +930,7 @@ static void RunJob(const char *user, CronLine *line)
|
|||||||
execl(DEFAULT_SHELL, DEFAULT_SHELL, "-c", line->cl_Shell, NULL);
|
execl(DEFAULT_SHELL, DEFAULT_SHELL, "-c", line->cl_Shell, NULL);
|
||||||
crondlog(ERR20 "can't exec, user %s cmd %s %s %s", user,
|
crondlog(ERR20 "can't exec, user %s cmd %s %s %s", user,
|
||||||
DEFAULT_SHELL, "-c", line->cl_Shell);
|
DEFAULT_SHELL, "-c", line->cl_Shell);
|
||||||
_exit(0);
|
_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
/* FORK FAILED */
|
/* FORK FAILED */
|
||||||
|
@ -283,9 +283,9 @@ static const char bb_msg_variable_not_found[] ALIGN1 = "variable: %s not found";
|
|||||||
#else
|
#else
|
||||||
#define info_logger(p, fmt, args...)
|
#define info_logger(p, fmt, args...)
|
||||||
#define msg_logger(p, fmt, args...)
|
#define msg_logger(p, fmt, args...)
|
||||||
#define msg_logger_and_die(p, fmt, args...) exit(1)
|
#define msg_logger_and_die(p, fmt, args...) exit(EXIT_FAILURE)
|
||||||
#define error_logger(p, fmt, args...)
|
#define error_logger(p, fmt, args...)
|
||||||
#define error_logger_and_die(p, fmt, args...) exit(1)
|
#define error_logger_and_die(p, fmt, args...) exit(EXIT_FAILURE)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void safe_memcpy(char *dest, const char *src, int len)
|
static void safe_memcpy(char *dest, const char *src, int len)
|
||||||
@ -402,7 +402,7 @@ int devfsd_main(int argc, char **argv)
|
|||||||
dir_operation(SERVICE, mount_point, 0, NULL);
|
dir_operation(SERVICE, mount_point, 0, NULL);
|
||||||
|
|
||||||
if (ENABLE_DEVFSD_FG_NP && no_polling)
|
if (ENABLE_DEVFSD_FG_NP && no_polling)
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
|
|
||||||
if (ENABLE_DEVFSD_VERBOSE || ENABLE_DEBUG)
|
if (ENABLE_DEVFSD_VERBOSE || ENABLE_DEBUG)
|
||||||
logmode = LOGMODE_BOTH;
|
logmode = LOGMODE_BOTH;
|
||||||
|
@ -882,7 +882,7 @@ static void colon_process(void)
|
|||||||
change_file(-1);
|
change_file(-1);
|
||||||
break;
|
break;
|
||||||
case 'q':
|
case 'q':
|
||||||
less_exit(0);
|
less_exit(EXIT_SUCCESS);
|
||||||
break;
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
change_file(0);
|
change_file(0);
|
||||||
@ -1270,7 +1270,7 @@ static void keypress_process(int keypress)
|
|||||||
buffer_line(cur_fline);
|
buffer_line(cur_fline);
|
||||||
break;
|
break;
|
||||||
case 'q': case 'Q':
|
case 'q': case 'Q':
|
||||||
less_exit(0);
|
less_exit(EXIT_SUCCESS);
|
||||||
break;
|
break;
|
||||||
#if ENABLE_FEATURE_LESS_MARKS
|
#if ENABLE_FEATURE_LESS_MARKS
|
||||||
case 'm':
|
case 'm':
|
||||||
|
@ -424,5 +424,5 @@ int time_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
return WTERMSIG(res.waitstatus);
|
return WTERMSIG(res.waitstatus);
|
||||||
if (WIFEXITED(res.waitstatus))
|
if (WIFEXITED(res.waitstatus))
|
||||||
return WEXITSTATUS(res.waitstatus);
|
return WEXITSTATUS(res.waitstatus);
|
||||||
fflush_stdout_and_exit(0);
|
fflush_stdout_and_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ static void watchdog_shutdown(int sig ATTRIBUTE_UNUSED)
|
|||||||
write(3, &V, 1); /* Magic, see watchdog-api.txt in kernel */
|
write(3, &V, 1); /* Magic, see watchdog-api.txt in kernel */
|
||||||
if (ENABLE_FEATURE_CLEAN_UP)
|
if (ENABLE_FEATURE_CLEAN_UP)
|
||||||
close(3);
|
close(3);
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
int watchdog_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int watchdog_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
|
@ -1124,7 +1124,7 @@ static void clean_up_and_exit(int sig ATTRIBUTE_UNUSED)
|
|||||||
close(sep->se_fd);
|
close(sep->se_fd);
|
||||||
}
|
}
|
||||||
remove_pidfile(_PATH_INETDPID);
|
remove_pidfile(_PATH_INETDPID);
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
int inetd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int inetd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
@ -1344,7 +1344,7 @@ int inetd_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
else
|
else
|
||||||
sep->se_builtin->bi_dgram_fn(ctrl, sep);
|
sep->se_builtin->bi_dgram_fn(ctrl, sep);
|
||||||
if (pid) /* we did vfork */
|
if (pid) /* we did vfork */
|
||||||
_exit(1);
|
_exit(EXIT_FAILURE);
|
||||||
maybe_close(accepted_fd);
|
maybe_close(accepted_fd);
|
||||||
continue; /* -> check next fd in fd set */
|
continue; /* -> check next fd in fd set */
|
||||||
}
|
}
|
||||||
@ -1408,7 +1408,7 @@ int inetd_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
/* eat packet in udp case */
|
/* eat packet in udp case */
|
||||||
if (sep->se_socktype != SOCK_STREAM)
|
if (sep->se_socktype != SOCK_STREAM)
|
||||||
recv(0, line, LINE_SIZE, MSG_DONTWAIT);
|
recv(0, line, LINE_SIZE, MSG_DONTWAIT);
|
||||||
_exit(1);
|
_exit(EXIT_FAILURE);
|
||||||
} /* for (sep = servtab...) */
|
} /* for (sep = servtab...) */
|
||||||
} /* for (;;) */
|
} /* for (;;) */
|
||||||
}
|
}
|
||||||
@ -1441,7 +1441,7 @@ static void echo_stream(int s, servtab_t *sep ATTRIBUTE_UNUSED)
|
|||||||
close(STDERR_FILENO);
|
close(STDERR_FILENO);
|
||||||
xopen("/dev/null", O_WRONLY);
|
xopen("/dev/null", O_WRONLY);
|
||||||
BB_EXECVP("cat", (char**)cat_args);
|
BB_EXECVP("cat", (char**)cat_args);
|
||||||
/* on failure we return to main, which does exit(1) */
|
/* on failure we return to main, which does exit(EXIT_FAILURE) */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
static void echo_dg(int s, servtab_t *sep)
|
static void echo_dg(int s, servtab_t *sep)
|
||||||
@ -1479,7 +1479,7 @@ static void discard_stream(int s, servtab_t *sep ATTRIBUTE_UNUSED)
|
|||||||
/* no error messages please... */
|
/* no error messages please... */
|
||||||
xdup2(STDOUT_FILENO, STDERR_FILENO);
|
xdup2(STDOUT_FILENO, STDERR_FILENO);
|
||||||
BB_EXECVP("cat", (char**)cat_args);
|
BB_EXECVP("cat", (char**)cat_args);
|
||||||
/* on failure we return to main, which does exit(1) */
|
/* on failure we return to main, which does exit(EXIT_FAILURE) */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
|
@ -284,7 +284,7 @@ static void parse_args(char **argv, int cmd, struct ip_tunnel_parm *p)
|
|||||||
struct ip_tunnel_parm old_p;
|
struct ip_tunnel_parm old_p;
|
||||||
memset(&old_p, 0, sizeof(old_p));
|
memset(&old_p, 0, sizeof(old_p));
|
||||||
if (do_get_ioctl(*argv, &old_p))
|
if (do_get_ioctl(*argv, &old_p))
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
*p = old_p;
|
*p = old_p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ int nc_main(int argc, char **argv)
|
|||||||
nread = safe_read(fd, iobuf, sizeof(iobuf));
|
nread = safe_read(fd, iobuf, sizeof(iobuf));
|
||||||
if (fd == cfd) {
|
if (fd == cfd) {
|
||||||
if (nread < 1)
|
if (nread < 1)
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
ofd = STDOUT_FILENO;
|
ofd = STDOUT_FILENO;
|
||||||
} else {
|
} else {
|
||||||
if (nread<1) {
|
if (nread<1) {
|
||||||
|
@ -755,7 +755,7 @@ int ping_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
|
|
||||||
dotted = xmalloc_sockaddr2dotted_noport(&lsa->u.sa);
|
dotted = xmalloc_sockaddr2dotted_noport(&lsa->u.sa);
|
||||||
ping(lsa);
|
ping(lsa);
|
||||||
print_stats_and_exit(0);
|
print_stats_and_exit(EXIT_SUCCESS);
|
||||||
/*return EXIT_SUCCESS;*/
|
/*return EXIT_SUCCESS;*/
|
||||||
}
|
}
|
||||||
#endif /* FEATURE_FANCY_PING */
|
#endif /* FEATURE_FANCY_PING */
|
||||||
|
@ -110,13 +110,13 @@ static void set_state(struct termios *state, int encap)
|
|||||||
/* Set encapsulation (SLIP, CSLIP, etc) */
|
/* Set encapsulation (SLIP, CSLIP, etc) */
|
||||||
if (ioctl_or_warn(handle, SIOCSIFENCAP, &encap) < 0) {
|
if (ioctl_or_warn(handle, SIOCSIFENCAP, &encap) < 0) {
|
||||||
bad:
|
bad:
|
||||||
restore_state_and_exit(1);
|
restore_state_and_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_handler(int signo ATTRIBUTE_UNUSED)
|
static void sig_handler(int signo ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
restore_state_and_exit(0);
|
restore_state_and_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
int slattach_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int slattach_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
@ -239,5 +239,5 @@ int slattach_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
system(extcmd);
|
system(extcmd);
|
||||||
|
|
||||||
/* Restore states and exit */
|
/* Restore states and exit */
|
||||||
restore_state_and_exit(0);
|
restore_state_and_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ static void conescape(void)
|
|||||||
" e exit telnet\r\n");
|
" e exit telnet\r\n");
|
||||||
|
|
||||||
if (read(0, &b, 1) <= 0)
|
if (read(0, &b, 1) <= 0)
|
||||||
doexit(1);
|
doexit(EXIT_FAILURE);
|
||||||
|
|
||||||
switch (b) {
|
switch (b) {
|
||||||
case 'l':
|
case 'l':
|
||||||
@ -143,7 +143,7 @@ static void conescape(void)
|
|||||||
rawmode();
|
rawmode();
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
doexit(0);
|
doexit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
write_str(1, "continuing...\r\n");
|
write_str(1, "continuing...\r\n");
|
||||||
@ -634,7 +634,7 @@ int telnet_main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
len = read(0, G.buf, DATABUFSIZE);
|
len = read(0, G.buf, DATABUFSIZE);
|
||||||
if (len <= 0)
|
if (len <= 0)
|
||||||
doexit(0);
|
doexit(EXIT_SUCCESS);
|
||||||
TRACE(0, ("Read con: %d\n", len));
|
TRACE(0, ("Read con: %d\n", len));
|
||||||
handlenetoutput(len);
|
handlenetoutput(len);
|
||||||
}
|
}
|
||||||
@ -648,7 +648,7 @@ int telnet_main(int argc, char **argv)
|
|||||||
len = read(G.netfd, G.buf, DATABUFSIZE);
|
len = read(G.netfd, G.buf, DATABUFSIZE);
|
||||||
if (len <= 0) {
|
if (len <= 0) {
|
||||||
write_str(1, "Connection closed by foreign host\r\n");
|
write_str(1, "Connection closed by foreign host\r\n");
|
||||||
doexit(1);
|
doexit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
TRACE(0, ("Read netfd (%d): %d\n", G.netfd, len));
|
TRACE(0, ("Read netfd (%d): %d\n", G.netfd, len));
|
||||||
handlenetinput(len);
|
handlenetinput(len);
|
||||||
|
@ -262,7 +262,7 @@ make_new_session(
|
|||||||
BB_EXECVP(loginpath, (char **)login_argv);
|
BB_EXECVP(loginpath, (char **)login_argv);
|
||||||
/* _exit is safer with vfork, and we shouldn't send message
|
/* _exit is safer with vfork, and we shouldn't send message
|
||||||
* to remote clients anyway */
|
* to remote clients anyway */
|
||||||
_exit(1); /*bb_perror_msg_and_die("execv %s", loginpath);*/
|
_exit(EXIT_FAILURE); /*bb_perror_msg_and_die("execv %s", loginpath);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Must match getopt32 string */
|
/* Must match getopt32 string */
|
||||||
@ -281,7 +281,7 @@ free_session(struct tsession *ts)
|
|||||||
struct tsession *t = sessions;
|
struct tsession *t = sessions;
|
||||||
|
|
||||||
if (option_mask32 & OPT_INETD)
|
if (option_mask32 & OPT_INETD)
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
|
|
||||||
/* Unlink this telnet session from the session list */
|
/* Unlink this telnet session from the session list */
|
||||||
if (t == ts)
|
if (t == ts)
|
||||||
@ -325,7 +325,7 @@ free_session(struct tsession *ts)
|
|||||||
|
|
||||||
#else /* !FEATURE_TELNETD_STANDALONE */
|
#else /* !FEATURE_TELNETD_STANDALONE */
|
||||||
|
|
||||||
/* Used in main() only, thus "return 0" actually is exit(0). */
|
/* Used in main() only, thus "return 0" actually is exit(EXIT_SUCCESS). */
|
||||||
#define free_session(ts) return 0
|
#define free_session(ts) return 0
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -523,7 +523,7 @@ static void reset_term(void)
|
|||||||
static void sig_catcher(int sig ATTRIBUTE_UNUSED)
|
static void sig_catcher(int sig ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
reset_term();
|
reset_term();
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
#endif /* FEATURE_USE_TERMIOS */
|
#endif /* FEATURE_USE_TERMIOS */
|
||||||
|
|
||||||
|
@ -640,7 +640,7 @@ int runsv_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
|
|
||||||
if (svd[0].want == W_EXIT && svd[0].state == S_DOWN) {
|
if (svd[0].want == W_EXIT && svd[0].state == S_DOWN) {
|
||||||
if (svd[1].pid == 0)
|
if (svd[1].pid == 0)
|
||||||
_exit(0);
|
_exit(EXIT_SUCCESS);
|
||||||
if (svd[1].want != W_EXIT) {
|
if (svd[1].want != W_EXIT) {
|
||||||
svd[1].want = W_EXIT;
|
svd[1].want = W_EXIT;
|
||||||
/* stopservice(&svd[1]); */
|
/* stopservice(&svd[1]); */
|
||||||
|
@ -343,7 +343,7 @@ int runsvdir_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
|
|
||||||
switch (exitsoon) {
|
switch (exitsoon) {
|
||||||
case 1:
|
case 1:
|
||||||
_exit(0);
|
_exit(EXIT_SUCCESS);
|
||||||
case 2:
|
case 2:
|
||||||
for (i = 0; i < svnum; i++)
|
for (i = 0; i < svnum; i++)
|
||||||
if (sv[i].pid)
|
if (sv[i].pid)
|
||||||
|
@ -612,7 +612,7 @@ int setfiles_main(int argc, char **argv)
|
|||||||
optind++;
|
optind++;
|
||||||
|
|
||||||
if (nerr)
|
if (nerr)
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input_filename) {
|
if (input_filename) {
|
||||||
|
@ -4789,7 +4789,7 @@ openhere(union node *redir)
|
|||||||
full_write(pip[1], redir->nhere.doc->narg.text, len);
|
full_write(pip[1], redir->nhere.doc->narg.text, len);
|
||||||
else
|
else
|
||||||
expandhere(redir->nhere.doc, pip[1]);
|
expandhere(redir->nhere.doc, pip[1]);
|
||||||
_exit(0);
|
_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
close(pip[1]);
|
close(pip[1]);
|
||||||
|
@ -45,7 +45,7 @@ main (argc, argv)
|
|||||||
{
|
{
|
||||||
for (envp = environ; *envp; envp++)
|
for (envp = environ; *envp; envp++)
|
||||||
puts (*envp);
|
puts (*envp);
|
||||||
exit (0);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* printenv varname */
|
/* printenv varname */
|
||||||
@ -59,9 +59,9 @@ main (argc, argv)
|
|||||||
if (*eval == '=')
|
if (*eval == '=')
|
||||||
{
|
{
|
||||||
puts (eval + 1);
|
puts (eval + 1);
|
||||||
exit (0);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exit (1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ char **argv;
|
|||||||
strprint(argv[i]);
|
strprint(argv[i]);
|
||||||
printf(">\n");
|
printf(">\n");
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -35,5 +35,5 @@ char **argv;
|
|||||||
}
|
}
|
||||||
|
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ static int run_pipeline(struct pipeline *line)
|
|||||||
run_applet_and_exit(cmd->argv[0],cmd->argc,cmd->argv);
|
run_applet_and_exit(cmd->argv[0],cmd->argc,cmd->argv);
|
||||||
execvp(cmd->argv[0],cmd->argv);
|
execvp(cmd->argv[0],cmd->argv);
|
||||||
printf("No %s",cmd->argv[0]);
|
printf("No %s",cmd->argv[0]);
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
} else waitpid(pid, &status, 0);
|
} else waitpid(pid, &status, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1480,7 +1480,7 @@ static void pseudo_exec_argv(char **argv)
|
|||||||
debug_printf_exec("execing '%s'\n", argv[0]);
|
debug_printf_exec("execing '%s'\n", argv[0]);
|
||||||
execvp(argv[0], argv);
|
execvp(argv[0], argv);
|
||||||
bb_perror_msg("cannot exec '%s'", argv[0]);
|
bb_perror_msg("cannot exec '%s'", argv[0]);
|
||||||
_exit(1);
|
_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called after [v]fork() in run_pipe()
|
/* Called after [v]fork() in run_pipe()
|
||||||
|
@ -2855,7 +2855,7 @@ static int forkexec(struct op *t, int *pin, int *pout, int no_fork, char **wp)
|
|||||||
if (t->op_type == TPAREN)
|
if (t->op_type == TPAREN)
|
||||||
_exit(execute(t->left, NOPIPE, NOPIPE, /* no_fork: */ 1));
|
_exit(execute(t->left, NOPIPE, NOPIPE, /* no_fork: */ 1));
|
||||||
if (wp[0] == NULL)
|
if (wp[0] == NULL)
|
||||||
_exit(0);
|
_exit(EXIT_SUCCESS);
|
||||||
|
|
||||||
cp = rexecve(wp[0], wp, makenv(0, NULL));
|
cp = rexecve(wp[0], wp, makenv(0, NULL));
|
||||||
prs(wp[0]);
|
prs(wp[0]);
|
||||||
@ -4207,7 +4207,7 @@ static int grave(int quoted)
|
|||||||
prs(argument_list[0]);
|
prs(argument_list[0]);
|
||||||
prs(": ");
|
prs(": ");
|
||||||
err(cp);
|
err(cp);
|
||||||
_exit(1);
|
_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4733,7 +4733,7 @@ static int filechar(struct ioarg *ap)
|
|||||||
while (size == 0 || position >= size) {
|
while (size == 0 || position >= size) {
|
||||||
size = read_line_input(current_prompt, filechar_cmdbuf, BUFSIZ, line_input_state);
|
size = read_line_input(current_prompt, filechar_cmdbuf, BUFSIZ, line_input_state);
|
||||||
if (size < 0) /* Error/EOF */
|
if (size < 0) /* Error/EOF */
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
position = 0;
|
position = 0;
|
||||||
/* if Ctrl-C, size == 0 and loop will repeat */
|
/* if Ctrl-C, size == 0 and loop will repeat */
|
||||||
}
|
}
|
||||||
@ -5212,7 +5212,7 @@ int msh_main(int argc, char **argv)
|
|||||||
|
|
||||||
name = *++argv;
|
name = *++argv;
|
||||||
if (newfile(name))
|
if (newfile(name))
|
||||||
exit(1); /* Exit on error */
|
exit(EXIT_FAILURE); /* Exit on error */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ static void interrupted(int sig ATTRIBUTE_UNUSED)
|
|||||||
{
|
{
|
||||||
signal(SIGINT, SIG_IGN);
|
signal(SIGINT, SIG_IGN);
|
||||||
shmdt(shbuf);
|
shmdt(shbuf);
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
int logread_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int logread_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
|
@ -394,7 +394,7 @@ read_line(const char *prompt)
|
|||||||
|
|
||||||
sz = read_line_input(prompt, line_buffer, sizeof(line_buffer), NULL);
|
sz = read_line_input(prompt, line_buffer, sizeof(line_buffer), NULL);
|
||||||
if (sz <= 0)
|
if (sz <= 0)
|
||||||
exit(0); /* Ctrl-D or Ctrl-C */
|
exit(EXIT_SUCCESS); /* Ctrl-D or Ctrl-C */
|
||||||
|
|
||||||
if (line_buffer[sz-1] == '\n')
|
if (line_buffer[sz-1] == '\n')
|
||||||
line_buffer[--sz] = '\0';
|
line_buffer[--sz] = '\0';
|
||||||
@ -2620,7 +2620,7 @@ xselect(void)
|
|||||||
if (ENABLE_FEATURE_CLEAN_UP)
|
if (ENABLE_FEATURE_CLEAN_UP)
|
||||||
close_dev_fd();
|
close_dev_fd();
|
||||||
bb_putchar('\n');
|
bb_putchar('\n');
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
case 'r':
|
case 'r':
|
||||||
return;
|
return;
|
||||||
case 's':
|
case 's':
|
||||||
|
@ -111,7 +111,7 @@ int ipcrm_main(int argc, char **argv)
|
|||||||
what = SEM;
|
what = SEM;
|
||||||
|
|
||||||
if (remove_ids(what, argc-2, &argv[2]))
|
if (remove_ids(what, argc-2, &argv[2]))
|
||||||
fflush_stdout_and_exit(1);
|
fflush_stdout_and_exit(EXIT_FAILURE);
|
||||||
printf("resource(s) deleted\n");
|
printf("resource(s) deleted\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -588,15 +588,15 @@ int ipcs_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
if (flags & flag_print) {
|
if (flags & flag_print) {
|
||||||
if (flags & flag_shm) {
|
if (flags & flag_shm) {
|
||||||
print_shm(id);
|
print_shm(id);
|
||||||
fflush_stdout_and_exit(0);
|
fflush_stdout_and_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
if (flags & flag_sem) {
|
if (flags & flag_sem) {
|
||||||
print_sem(id);
|
print_sem(id);
|
||||||
fflush_stdout_and_exit(0);
|
fflush_stdout_and_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
if (flags & flag_msg) {
|
if (flags & flag_msg) {
|
||||||
print_msg(id);
|
print_msg(id);
|
||||||
fflush_stdout_and_exit(0);
|
fflush_stdout_and_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
bb_show_usage();
|
bb_show_usage();
|
||||||
}
|
}
|
||||||
@ -617,5 +617,5 @@ int ipcs_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
do_msg();
|
do_msg();
|
||||||
bb_putchar('\n');
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
fflush_stdout_and_exit(0);
|
fflush_stdout_and_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user