112 lines
3.2 KiB
Diff
112 lines
3.2 KiB
Diff
|
--- acpid-1.0.6/acpid.c.log 2007-10-11 17:56:11.000000000 +0200
|
||
|
+++ acpid-1.0.6/acpid.c 2007-10-12 10:50:36.000000000 +0200
|
||
|
@@ -158,7 +158,7 @@ main(int argc, char **argv)
|
||
|
if (open_log() < 0) {
|
||
|
exit(EXIT_FAILURE);
|
||
|
}
|
||
|
- acpid_log(LOG_INFO, "starting up\n");
|
||
|
+ acpid_log(LOG_NOTICE, "starting up\n");
|
||
|
|
||
|
/* trap key signals */
|
||
|
signal(SIGHUP, reload_conf);
|
||
|
@@ -205,11 +205,15 @@ main(int argc, char **argv)
|
||
|
/* read and handle an event */
|
||
|
event = read_line(event_fd);
|
||
|
if (event) {
|
||
|
- acpid_log(LOG_INFO,
|
||
|
- "received event \"%s\"\n", event);
|
||
|
+ if(acpid_debug) {
|
||
|
+ acpid_log(LOG_INFO,
|
||
|
+ "received event \"%s\"\n", event);
|
||
|
+ }
|
||
|
acpid_handle_event(event);
|
||
|
- acpid_log(LOG_INFO,
|
||
|
- "completed event \"%s\"\n", event);
|
||
|
+ if (acpid_debug) {
|
||
|
+ acpid_log(LOG_INFO,
|
||
|
+ "completed event \"%s\"\n", event);
|
||
|
+ }
|
||
|
} else if (errno == EPIPE) {
|
||
|
acpid_log(LOG_WARNING,
|
||
|
"events file connection closed\n");
|
||
|
--- acpid-1.0.6/event.c.log 2007-10-11 17:56:11.000000000 +0200
|
||
|
+++ acpid-1.0.6/event.c 2007-10-12 10:50:48.000000000 +0200
|
||
|
@@ -154,8 +154,10 @@ acpid_read_conf(const char *confdir)
|
||
|
closedir(dir);
|
||
|
unlock_rules();
|
||
|
|
||
|
- acpid_log(LOG_INFO, "%d rule%s loaded\n",
|
||
|
- nrules, (nrules == 1)?"":"s");
|
||
|
+ if (acpid_debug) {
|
||
|
+ acpid_log(LOG_INFO, "%d rule%s loaded\n",
|
||
|
+ nrules, (nrules == 1)?"":"s");
|
||
|
+ }
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
@@ -341,9 +343,11 @@ acpid_add_client(int clifd, const char *
|
||
|
nrules++;
|
||
|
}
|
||
|
|
||
|
- acpid_log(LOG_INFO, "%d client rule%s loaded\n",
|
||
|
- nrules, (nrules == 1)?"":"s");
|
||
|
-
|
||
|
+ if (acpid_debug) {
|
||
|
+ acpid_log(LOG_INFO, "%d client rule%s loaded\n",
|
||
|
+ nrules, (nrules == 1)?"":"s");
|
||
|
+ }
|
||
|
+
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
@@ -565,8 +569,9 @@ do_cmd_rule(struct rule *rule, const cha
|
||
|
case 0: /* child */
|
||
|
/* parse the commandline, doing any substitutions needed */
|
||
|
action = parse_cmd(rule->action.cmd, event);
|
||
|
- acpid_log(LOG_INFO, "executing action \"%s\"\n", action);
|
||
|
-
|
||
|
+ if (acpid_debug) {
|
||
|
+ acpid_log(LOG_INFO, "executing action \"%s\"\n", action);
|
||
|
+ }
|
||
|
/* reset signals */
|
||
|
signal(SIGHUP, SIG_DFL);
|
||
|
signal(SIGTERM, SIG_DFL);
|
||
|
@@ -588,14 +593,20 @@ do_cmd_rule(struct rule *rule, const cha
|
||
|
if (acpid_debug)
|
||
|
fprintf(stdout, "END HANDLER MESSAGES\n");
|
||
|
if (WIFEXITED(status)) {
|
||
|
- acpid_log(LOG_INFO, "action exited with status %d\n",
|
||
|
- WEXITSTATUS(status));
|
||
|
+ if (acpid_debug) {
|
||
|
+ acpid_log(LOG_INFO, "action exited with status %d\n",
|
||
|
+ WEXITSTATUS(status));
|
||
|
+ }
|
||
|
} else if (WIFSIGNALED(status)) {
|
||
|
- acpid_log(LOG_INFO, "action exited on signal %d\n",
|
||
|
- WTERMSIG(status));
|
||
|
+ if (acpid_debug) {
|
||
|
+ acpid_log(LOG_INFO, "action exited on signal %d\n",
|
||
|
+ WTERMSIG(status));
|
||
|
+ }
|
||
|
} else {
|
||
|
- acpid_log(LOG_INFO, "action exited with status %d\n",
|
||
|
- status);
|
||
|
+ if (acpid_debug) {
|
||
|
+ acpid_log(LOG_INFO, "action exited with status %d\n",
|
||
|
+ status);
|
||
|
+ }
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
@@ -607,7 +618,9 @@ do_client_rule(struct rule *rule, const
|
||
|
int r;
|
||
|
int client = rule->action.fd;
|
||
|
|
||
|
- acpid_log(LOG_INFO, "notifying client %s\n", rule->origin);
|
||
|
+ if (acpid_debug) {
|
||
|
+ acpid_log(LOG_INFO, "notifying client %s\n", rule->origin);
|
||
|
+ }
|
||
|
|
||
|
r = safe_write(client, event, strlen(event));
|
||
|
if (r < 0 && errno == EPIPE) {
|