#if ENABLE_DEBUG_INIT
#define messageD message
#else
-#define messageD(...) do {;} while(0);
+#define messageD(...) do {} while (0)
#endif
static void message(int device, const char *fmt, ...)
__attribute__ ((format(printf, 2, 3)));
/* Log the message to syslogd */
if (device & LOG) {
/* don`t out "\r\n" */
- openlog(bb_applet_name, 0, LOG_DAEMON);
+ openlog(applet_name, 0, LOG_DAEMON);
syslog(LOG_INFO, "%s", msg + 1);
closelog();
}
if (log_fd < 0) {
if ((log_fd = device_open(log_console, O_RDWR | O_NONBLOCK | O_NOCTTY)) < 0) {
log_fd = -2;
- bb_error_msg("Bummer, can't write to log on %s!", log_console);
+ bb_error_msg("bummer, can't write to log on %s!", log_console);
device = CONSOLE;
} else {
fcntl(log_fd, F_SETFD, FD_CLOEXEC);
#if ENABLE_DEBUG_INIT
/* all descriptors may be closed */
} else {
- bb_error_msg("Bummer, can't print: ");
+ bb_error_msg("bummer, can't print: ");
va_start(arguments, fmt);
vfprintf(stderr, fmt, arguments);
va_end(arguments);
"(pid %d, terminal %s)\n",
cmdpath, getpid(), a->terminal);
full_write(1, press_enter, sizeof(press_enter) - 1);
- while(read(0, &c, 1) == 1 && c != '\n')
+ while (read(0, &c, 1) == 1 && c != '\n')
;
}
#endif
execv(cmdpath, cmd);
/* We're still here? Some error happened. */
- message(LOG | CONSOLE, "Bummer, could not run '%s': %m", cmdpath);
+ message(LOG | CONSOLE, "Bummer, cannot run '%s': %m", cmdpath);
_exit(-1);
}
sigprocmask(SIG_SETMASK, &omask, NULL);
#if !ENABLE_DEBUG_INIT
/* Expect to be invoked as init with PID=1 or be invoked as linuxrc */
if (getpid() != 1 &&
- (!ENABLE_FEATURE_INITRD || !strstr(bb_applet_name, "linuxrc")))
+ (!ENABLE_FEATURE_INITRD || !strstr(applet_name, "linuxrc")))
{
bb_show_usage();
}
{
const char * const *e;
/* Make sure environs is set to something sane */
- for(e = environment; *e; e++)
+ for (e = environment; *e; e++)
putenv((char *) *e);
}
struct sysinfo info;
if (!sysinfo(&info) &&
- (info.mem_unit ? : 1) * (long long)info.totalram < MEGABYTE)
+ (info.mem_unit ? : 1) * (long long)info.totalram < 1024*1024)
{
message(CONSOLE,"Low memory: forcing swapon.");
/* swapon -a requires /proc typically */
}
/* Check if we are supposed to be in single user mode */
- if (argc > 1 && (!strcmp(argv[1], "single") ||
- !strcmp(argv[1], "-s") || !strcmp(argv[1], "1"))) {
+ if (argc > 1
+ && (!strcmp(argv[1], "single") || !strcmp(argv[1], "-s") || LONE_CHAR(argv[1], '1'))
+ ) {
/* Start a shell on console */
new_init_action(RESPAWN, bb_default_login_shell, "");
} else {
}
}
/* see if anyone else is waiting to be reaped */
- wpid = waitpid (-1, NULL, WNOHANG);
+ wpid = waitpid(-1, NULL, WNOHANG);
}
}
}