aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-11-22 16:35:56 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2020-11-22 16:35:56 +0100
commit03eb6eba436ca6198e5346ebb9d22a30d2f527a4 (patch)
treee795bfb384fdc57bfa3f6008f58c8c0140af52a2
parentcb143b9793a8a17a753a215ddfe42a57490c65f7 (diff)
downloadbusybox-w32-03eb6eba436ca6198e5346ebb9d22a30d2f527a4.tar.gz
busybox-w32-03eb6eba436ca6198e5346ebb9d22a30d2f527a4.tar.bz2
busybox-w32-03eb6eba436ca6198e5346ebb9d22a30d2f527a4.zip
mdev: clear LOGMODE_STDIO only directly before daemonizing
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--util-linux/mdev.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 2cf98b1a4..9a8c14456 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -1279,21 +1279,17 @@ int mdev_main(int argc UNUSED_PARAM, char **argv)
1279 1279
1280#if ENABLE_FEATURE_MDEV_DAEMON 1280#if ENABLE_FEATURE_MDEV_DAEMON
1281 if (opt & MDEV_OPT_DAEMON) { 1281 if (opt & MDEV_OPT_DAEMON) {
1282 int fd; 1282 /* Daemon mode listening on uevent netlink socket. Fork away
1283
1284 /* there is no point in write()ing to /dev/null */
1285 if (!(opt & MDEV_OPT_FOREGROUND))
1286 logmode &= ~LOGMODE_STDIO;
1287
1288 /*
1289 * Daemon mode listening on uevent netlink socket. Fork away
1290 * after initial scan so that caller can be sure everything 1283 * after initial scan so that caller can be sure everything
1291 * is up-to-date when mdev process returns. 1284 * is up-to-date when mdev process returns.
1292 */ 1285 */
1293 fd = daemon_init(temp); 1286 int fd = daemon_init(temp);
1294 1287
1295 if (!(opt & MDEV_OPT_FOREGROUND)) 1288 if (!(opt & MDEV_OPT_FOREGROUND)) {
1289 /* there is no point in logging to /dev/null */
1290 logmode &= ~LOGMODE_STDIO;
1296 bb_daemonize_or_rexec(0, argv); 1291 bb_daemonize_or_rexec(0, argv);
1292 }
1297 1293
1298 daemon_loop(temp, fd); 1294 daemon_loop(temp, fd);
1299 } 1295 }