14.06.2023 23:52, Michael Tokarev wrote:
Actually it doesn't work on regular system too, the fd#0 is redirected
from /dev/null somewhere down the line and enters a tight loop

Attached is the fix. Not touching daemonize_or_reexec().

Signed-off-by: Michael Tokarev <m...@tls.msk.ru>

--- busybox.orig/sysklogd/syslogd.c
+++ busybox/sysklogd/syslogd.c
@@ -1009,6 +1009,7 @@ static int try_to_resolve_remote(remoteH
 static int NOINLINE syslogd_init(char **argv)
 {
 	int opts;
+	int fd;
 	char OPTION_DECL;
 #if ENABLE_FEATURE_REMOTE_LOG
 	llist_t *remoteAddrList = NULL;
@@ -1056,7 +1057,7 @@ static int NOINLINE syslogd_init(char **
 	G.hostname = safe_gethostname();
 	*strchrnul(G.hostname, '.') = '\0';
 
-	xmove_fd(create_socket(), STDIN_FILENO);
+	fd = create_socket();
 
 	if (opts & OPT_circularlog)
 		ipcsyslog_init();
@@ -1068,6 +1069,8 @@ static int NOINLINE syslogd_init(char **
 		bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv);
 	}
 
+	xmove_fd(fd, STDIN_FILENO);
+
 	/* Set up signal handlers (so that they interrupt read()) */
 	signal_no_SA_RESTART_empty_mask(SIGTERM, record_signo);
 	signal_no_SA_RESTART_empty_mask(SIGINT, record_signo);
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to