--- acpid-1.0.10-netlink3/acpid.c 2009-05-02 05:22:00.000000000 +0300 +++ acpid-1.0.10-netlink3-patched/acpid.c 2010-03-05 22:20:00.000000000 +0200 @@ -60,6 +60,8 @@ static const char *pidfile = ACPID_PIDFILE; static int netlink; +static int no_log; + int main(int argc, char **argv) { @@ -235,6 +237,7 @@ {"netlink", 0, 0, 'n'}, {"version", 0, 0, 'v'}, {"help", 0, 0, 'h'}, + {"no-logging", 0, 0, 'N'}, {NULL, 0, 0, 0}, }; const char *opts_help[] = { @@ -253,6 +256,7 @@ "Force netlink/input layer mode. (overrides -e)", /* netlink */ "Print version information.", /* version */ "Print this message.", /* help */ + "Do not do any logging at all.", /* no-logging */ }; struct option *opt; const char **hlp; @@ -261,11 +265,14 @@ for (;;) { int i; i = getopt_long(*argc, *argv, - "c:C:de:flg:m:s:Sp:L:nvh", opts, NULL); + "Nc:C:de:flg:m:s:Sp:L:nvh", opts, NULL); if (i == -1) { break; } switch (i) { + case 'N': + no_log = 1; + break; case 'c': confdir = optarg; break; @@ -396,7 +403,9 @@ if (acpid_debug) { log_opts |= LOG_PERROR; } - openlog(PACKAGE, log_opts, LOG_DAEMON); + if (!no_log) { + openlog(PACKAGE, log_opts, LOG_DAEMON); + } /* set up stdin, stdout, stderr to /dev/null */ if (dup2(nullfd, STDIN_FILENO) != STDIN_FILENO) { @@ -476,6 +485,9 @@ #endif acpid_log(int level, const char *fmt, ...) { + if (no_log) { + return 0; + } va_list args; va_start(args, fmt);