mirror of https://github.com/mirror/busybox.git
syslogd: fix breakage caused by "daemonize _after_ init" change
function old new delta syslogd_init 1007 1140 +133 create_socket 143 - -143 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/0 up/down: 133/-143) Total: -10 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>master
parent
92ab29fcf0
commit
5fa39d48d5
|
@ -956,9 +956,7 @@ static void do_mark(int sig)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Don't inline: prevent struct sockaddr_un to take up space on stack
|
static int create_socket(void)
|
||||||
* permanently */
|
|
||||||
static NOINLINE int create_socket(void)
|
|
||||||
{
|
{
|
||||||
struct sockaddr_un sunx;
|
struct sockaddr_un sunx;
|
||||||
int sock_fd;
|
int sock_fd;
|
||||||
|
@ -1008,6 +1006,7 @@ static int try_to_resolve_remote(remoteHost_t *rh)
|
||||||
static int NOINLINE syslogd_init(char **argv)
|
static int NOINLINE syslogd_init(char **argv)
|
||||||
{
|
{
|
||||||
int opts;
|
int opts;
|
||||||
|
int fd;
|
||||||
char OPTION_DECL;
|
char OPTION_DECL;
|
||||||
#if ENABLE_FEATURE_REMOTE_LOG
|
#if ENABLE_FEATURE_REMOTE_LOG
|
||||||
llist_t *remoteAddrList = NULL;
|
llist_t *remoteAddrList = NULL;
|
||||||
|
@ -1055,7 +1054,7 @@ static int NOINLINE syslogd_init(char **argv)
|
||||||
G.hostname = safe_gethostname();
|
G.hostname = safe_gethostname();
|
||||||
*strchrnul(G.hostname, '.') = '\0';
|
*strchrnul(G.hostname, '.') = '\0';
|
||||||
|
|
||||||
xmove_fd(create_socket(), STDIN_FILENO);
|
fd = create_socket();
|
||||||
|
|
||||||
if (opts & OPT_circularlog)
|
if (opts & OPT_circularlog)
|
||||||
ipcsyslog_init();
|
ipcsyslog_init();
|
||||||
|
@ -1067,6 +1066,8 @@ static int NOINLINE syslogd_init(char **argv)
|
||||||
bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv);
|
bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xmove_fd(fd, STDIN_FILENO);
|
||||||
|
|
||||||
/* Set up signal handlers (so that they interrupt read()) */
|
/* Set up signal handlers (so that they interrupt read()) */
|
||||||
signal_no_SA_RESTART_empty_mask(SIGTERM, record_signo);
|
signal_no_SA_RESTART_empty_mask(SIGTERM, record_signo);
|
||||||
signal_no_SA_RESTART_empty_mask(SIGINT, record_signo);
|
signal_no_SA_RESTART_empty_mask(SIGINT, record_signo);
|
||||||
|
|
Loading…
Reference in New Issue