dd: code shrink
[oweals/busybox.git] / util-linux / acpid.c
index 361a2b206285cf18bc74424a6397da5d2a41ca94..38421c2d7f1cc15c621d2c2cff6384b97cf0f175 100644 (file)
@@ -75,6 +75,7 @@ struct acpi_event {
 static const struct acpi_event f_evt_tab[] = {
        { "EV_KEY", 0x01, "KEY_POWER", 116, 1, "button/power PWRF 00000080" },
        { "EV_KEY", 0x01, "KEY_POWER", 116, 1, "button/power PWRB 00000080" },
+       { "EV_SW", 0x05, "SW_LID", 0x00, 1, "button/lid LID0 00000080" },
 };
 
 struct acpi_action {
@@ -234,7 +235,7 @@ int acpid_main(int argc UNUSED_PARAM, char **argv)
        const char *opt_action = "/etc/acpid.conf";
        const char *opt_map = "/etc/acpi.map";
 #if ENABLE_FEATURE_PIDFILE
-       const char *opt_pidfile = "/var/run/acpid.pid";
+       const char *opt_pidfile = CONFIG_PID_FILE_PATH "/acpid.pid";
 #endif
 
        INIT_G();
@@ -268,8 +269,12 @@ int acpid_main(int argc UNUSED_PARAM, char **argv)
 
        xchdir(opt_dir);
 
+       /* We spawn children but don't wait for them. Prevent zombies: */
        bb_signals((1 << SIGCHLD), SIG_IGN);
-       bb_signals(BB_FATAL_SIGS, record_signo);
+       // If you enable this, (1) explain why, (2)
+       // make sure while(poll) loop below is still interruptible
+       // by SIGTERM et al:
+       //bb_signals(BB_FATAL_SIGS, record_signo);
 
        pfd = NULL;
        nfd = 0;
@@ -337,7 +342,7 @@ int acpid_main(int argc UNUSED_PARAM, char **argv)
                        }
                        if (!event)
                                continue;
-                       // spawn event handler
+                       /* spawn event handler */
                        process_event(event);
                }
        }