Hello community,

here is the log from the commit of package acpid for openSUSE:Factory
checked in at Thu Apr 21 12:35:10 CEST 2011.



--------

calling whatdependson for head-i586


Old:
----
  _service:download_url:acpid-2.0.8.tar.gz

New:
----
  _service:download_url:acpid-2.0.9.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ acpid.spec ++++++
--- /var/tmp/diff_new_pack.7EdjXt/_old  2011-04-21 12:34:04.000000000 +0200
+++ /var/tmp/diff_new_pack.7EdjXt/_new  2011-04-21 12:34:04.000000000 +0200
@@ -20,7 +20,7 @@
 
 Name:           acpid
 Url:            http://tedfelix.com/linux/acpid-netlink.html
-Version:        2.0.8
+Version:        2.0.9
 Release:        1
 License:        GPLv2+
 Group:          System/Daemons

++++++ _service ++++++
--- /var/tmp/diff_new_pack.7EdjXt/_old  2011-04-21 12:34:04.000000000 +0200
+++ /var/tmp/diff_new_pack.7EdjXt/_new  2011-04-21 12:34:04.000000000 +0200
@@ -2,11 +2,11 @@
   <service name="download_url">
     <param name="protocol">http</param>
     <param name="host">tedfelix.com</param>
-    <param name="path">/linux/acpid-2.0.8.tar.gz</param>
+    <param name="path">/linux/acpid-2.0.9.tar.gz</param>
   </service>
   <service name="verify_file">
-    <param name="file">_service:download_url:acpid-2.0.8.tar.gz</param>
+    <param name="file">_service:download_url:acpid-2.0.9.tar.gz</param>
     <param name="verifier">sha256</param>
-    <param 
name="checksum">af1ebddef17412fc3f00994a624fbb912ebe885437c13a7e87f3142f8339ce8c</param>
+    <param 
name="checksum">f02a4931083ef52e6785c989d9d44720387c1d65a42bdcd364e3b06cd588ba65</param>
   </service>
-</services>
\ No newline at end of file
+</services>

++++++ _service:download_url:acpid-2.0.8.tar.gz -> 
_service:download_url:acpid-2.0.9.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/acpid-2.0.8/Changelog new/acpid-2.0.9/Changelog
--- old/acpid-2.0.8/Changelog   2011-02-15 23:45:50.000000000 +0100
+++ new/acpid-2.0.9/Changelog   2011-04-15 19:12:47.000000000 +0200
@@ -1,4 +1,16 @@
-* Tue Feb 15 2010  Ted Felix <http://www.tedfelix.com>
+* Fri Apr 15 2011  Ted Felix <http://www.tedfelix.com>
+  - 2.0.9 release
+  - Removed newlines from acpid_log() calls and modified acpid_log() to
+    no longer need newlines.  This change to acpid prevents blank lines in
+    the log for versions of syslogd that preserve newlines.  (acpid.c 
+    connection_list.c event.c inotify_handler.c input_layer.c netlink.c 
+    proc.c sock.c)  (Michael Meskes, Ted Felix)
+  - Added fcntl() for O_NONBLOCK on the client sockets.  This prevents acpid
+    from hanging if a client behaves badly.  (sock.c)  (Vasiliy Kulikov)
+    From: http://www.openwall.com/lists/oss-security/2011/01/19/4
+  - Improvements to error handling.  (sock.c)  (Ted Felix)
+
+* Tue Feb 15 2011  Ted Felix <http://www.tedfelix.com>
   - 2.0.8 release
   - Fixed "comparison between signed and unsigned integer expressions"
     error with gcc 4.6.  (libnetlink.c) (Eugeni Dodonov)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/acpid-2.0.8/Makefile new/acpid-2.0.9/Makefile
--- old/acpid-2.0.8/Makefile    2010-11-15 19:43:28.000000000 +0100
+++ new/acpid-2.0.9/Makefile    2011-03-12 17:06:19.000000000 +0100
@@ -1,7 +1,7 @@
 # Makefile for ACPI daemon
 
 # update these numbers for new releases
-VERSION = 2.0.8
+VERSION = 2.0.9
 
 OPT = -O2
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/acpid-2.0.8/TESTPLAN new/acpid-2.0.9/TESTPLAN
--- old/acpid-2.0.8/TESTPLAN    2009-11-11 21:38:21.000000000 +0100
+++ new/acpid-2.0.9/TESTPLAN    2011-03-19 03:37:20.000000000 +0100
@@ -5,6 +5,7 @@
 - Run all these tests with valgrind to detect memory leaks.
 - It's best to test without a window manager running (such as GNOME or KDE) as 
they tend to handle acpi events on their own and override acpid.  To bring down 
X on a system that is configured with a graphical login, there's usually an 
"init" script you can run.  As an example, with Debian/GNOME, log off of your 
X/GNOME session, switch to another tty (e.g. Alt-Ctrl-F1), login, and do this:
   sudo /etc/init.d/gdm stop
+  [need instructions for upstart, maybe this: sudo initctl gdm stop]
 Now X is out of the way and you can test from the console.
 - You can kill acpid with "sudo killall acpid".
 - To make testing more convenient, you can run acpid from a shell as "acpid 
-ld" to get maximum logging.  Use Ctrl-C to stop acpid.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/acpid-2.0.8/acpid.c new/acpid-2.0.9/acpid.c
--- old/acpid-2.0.8/acpid.c     2010-11-09 22:55:28.000000000 +0100
+++ new/acpid-2.0.9/acpid.c     2011-03-24 12:20:59.000000000 +0100
@@ -116,7 +116,7 @@
                exit(EXIT_FAILURE);
        }
        
-       acpid_log(LOG_INFO, "starting up with %s\n",
+       acpid_log(LOG_INFO, "starting up with %s",
                netlink ? "netlink and the input layer" : "proc fs");
 
        /* trap key signals */
@@ -136,7 +136,7 @@
                exit(EXIT_FAILURE);
        }
 
-       acpid_log(LOG_INFO, "waiting for events: event logging is %s\n",
+       acpid_log(LOG_INFO, "waiting for events: event logging is %s",
            logevents ? "on" : "off");
 
        /* main loop */
@@ -156,7 +156,7 @@
                if (nready < 0  &&  errno == EINTR) {
                        continue;
                } else if (nready < 0) {
-                       acpid_log(LOG_ERR, "select(): %s\n", strerror(errno));
+                       acpid_log(LOG_ERR, "select(): %s", strerror(errno));
                        continue;
                }
 
@@ -335,7 +335,7 @@
        /* fork off the parent process */
        pid = fork();
        if (pid < 0) {
-               acpid_log(LOG_ERR, "fork: %s\n", strerror(errno));
+               acpid_log(LOG_ERR, "fork: %s", strerror(errno));
                return -1;
        }
        /* if we got a good PID, then we can exit the parent process */
@@ -353,14 +353,14 @@
        /* detach the process from the parent (normally a shell) */
        sid = setsid();
        if (sid < 0) {
-               acpid_log(LOG_ERR, "setsid: %s\n", strerror(errno));
+               acpid_log(LOG_ERR, "setsid: %s", strerror(errno));
                return -1;
        }
 
     /* Change the current working directory.  This prevents the current
        directory from being locked; hence not being able to remove it. */
        if (chdir("/") < 0) {
-               acpid_log(LOG_ERR, "chdir(\"/\"): %s\n", strerror(errno));
+               acpid_log(LOG_ERR, "chdir(\"/\"): %s", strerror(errno));
                return -1;
        }
 
@@ -388,21 +388,21 @@
        /* open /dev/null */
        nullfd = open("/dev/null", O_RDWR);
        if (nullfd < 0) {
-               acpid_log(LOG_ERR, "can't open /dev/null: %s\n", 
strerror(errno));
+               acpid_log(LOG_ERR, "can't open /dev/null: %s", strerror(errno));
                return -1;
        }
 
        /* set up stdin, stdout, stderr to /dev/null */
        if (dup2(nullfd, STDIN_FILENO) != STDIN_FILENO) {
-               acpid_log(LOG_ERR, "dup2() stdin: %s\n", strerror(errno));
+               acpid_log(LOG_ERR, "dup2() stdin: %s", strerror(errno));
                return -1;
        }
        if (!acpid_debug && dup2(nullfd, STDOUT_FILENO) != STDOUT_FILENO) {
-               acpid_log(LOG_ERR, "dup2() stdout: %s\n", strerror(errno));
+               acpid_log(LOG_ERR, "dup2() stdout: %s", strerror(errno));
                return -1;
        }
        if (!acpid_debug && dup2(nullfd, STDERR_FILENO) != STDERR_FILENO) {
-               acpid_log(LOG_ERR, "dup2() stderr: %s\n", strerror(errno));
+               acpid_log(LOG_ERR, "dup2() stderr: %s", strerror(errno));
                return -1;
        }
 
@@ -436,7 +436,7 @@
        }
 
        /* something went wrong */
-       acpid_log(LOG_ERR, "can't create pidfile %s: %s\n",
+       acpid_log(LOG_ERR, "can't create pidfile %s: %s",
                    pidfile, strerror(errno));
        return -1;
 }
@@ -445,7 +445,7 @@
 clean_exit_with_status(int status)
 {
        acpid_cleanup_rules(1);
-       acpid_log(LOG_NOTICE, "exiting\n");
+       acpid_log(LOG_NOTICE, "exiting");
        unlink(pidfile);
        exit(status);
 }
@@ -459,7 +459,7 @@
 static void
 reload_conf(int sig __attribute__((unused)))
 {
-       acpid_log(LOG_NOTICE, "reloading configuration\n");
+       acpid_log(LOG_NOTICE, "reloading configuration");
        acpid_cleanup_rules(0);
        acpid_read_conf(confdir);
 }
@@ -479,6 +479,8 @@
                        va_start(args, fmt);
                        vfprintf(stderr, fmt, args);
                        va_end(args);
+
+            fprintf(stderr, "\n");
                }
        } else {
                va_start(args, fmt);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/acpid-2.0.8/connection_list.c 
new/acpid-2.0.9/connection_list.c
--- old/acpid-2.0.8/connection_list.c   2010-03-28 16:28:19.000000000 +0200
+++ new/acpid-2.0.9/connection_list.c   2011-03-12 17:13:07.000000000 +0100
@@ -54,7 +54,7 @@
        if (nconnections < 0)
                return;
        if (nconnections >= MAX_CONNECTIONS) {
-               acpid_log(LOG_ERR, "Too many connections.\n");
+               acpid_log(LOG_ERR, "Too many connections.");
                /* ??? This routine should return -1 in this situation so that 
*/
                /*   callers can clean up any open fds and whatnot.  */
                return;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/acpid-2.0.8/event.c new/acpid-2.0.9/event.c
--- old/acpid-2.0.8/event.c     2010-09-28 00:26:48.000000000 +0200
+++ new/acpid-2.0.9/event.c     2011-03-12 17:18:09.000000000 +0100
@@ -100,7 +100,7 @@
 
        dir = opendir(confdir);
        if (!dir) {
-               acpid_log(LOG_ERR, "opendir(%s): %s\n",
+               acpid_log(LOG_ERR, "opendir(%s): %s",
                        confdir, strerror(errno));
                unlock_rules();
                return -1;
@@ -109,7 +109,7 @@
        /* Compile the regular expression.  This is based on run-parts(8). */
        rc = regcomp(&preg, "^[a-zA-Z0-9_-]+$", RULE_REGEX_FLAGS);
        if (rc) {
-               acpid_log(LOG_ERR, "regcomp(): %d\n", rc);
+               acpid_log(LOG_ERR, "regcomp(): %d", rc);
                unlock_rules();
                return -1;
        }
@@ -130,7 +130,7 @@
 
                /* skip any files that don't match the run-parts convention */
                if (regexec(&preg, dirent->d_name, 0, NULL, 0) != 0) {
-                       acpid_log(LOG_INFO, "skipping conf file %s/%s\n", 
+                       acpid_log(LOG_INFO, "skipping conf file %s/%s", 
                                confdir, dirent->d_name);
                        continue;
                }
@@ -141,7 +141,7 @@
 
                file = malloc(len);
                if (!file) {
-                       acpid_log(LOG_ERR, "malloc(): %s\n", strerror(errno));
+                       acpid_log(LOG_ERR, "malloc(): %s", strerror(errno));
                        unlock_rules();
                        return -1;
                }
@@ -149,13 +149,13 @@
 
                /* allow only regular files and symlinks to files */
                if (stat(file, &stat_buf) != 0) {
-                       acpid_log(LOG_ERR, "stat(%s): %s\n", file,
+                       acpid_log(LOG_ERR, "stat(%s): %s", file,
                                strerror(errno));
                        free(file);
                        continue; /* keep trying the rest of the files */
                }
                if (!S_ISREG(stat_buf.st_mode)) {
-                       acpid_log(LOG_INFO, "skipping non-file %s\n", file);
+                       acpid_log(LOG_INFO, "skipping non-file %s", file);
                        free(file);
                        continue; /* skip non-regular files */
                }
@@ -170,7 +170,7 @@
        closedir(dir);
        unlock_rules();
 
-       acpid_log(LOG_INFO, "%d rule%s loaded\n",
+       acpid_log(LOG_INFO, "%d rule%s loaded",
            nrules, (nrules == 1)?"":"s");
 
        return 0;
@@ -188,7 +188,7 @@
        lock_rules();
 
        if (acpid_debug >= 3) {
-               acpid_log(LOG_DEBUG, "cleaning up rules\n");
+               acpid_log(LOG_DEBUG, "cleaning up rules");
        }
 
        if (do_detach) {
@@ -225,11 +225,11 @@
        int line = 0;
        struct rule *r;
 
-       acpid_log(LOG_DEBUG, "parsing conf file %s\n", file);
+       acpid_log(LOG_DEBUG, "parsing conf file %s", file);
 
        fp = fopen(file, "r");
        if (!fp) {
-               acpid_log(LOG_ERR, "fopen(%s): %s\n", file, strerror(errno));
+               acpid_log(LOG_ERR, "fopen(%s): %s", file, strerror(errno));
                return NULL;
        }
 
@@ -242,7 +242,7 @@
        r->type = RULE_CMD;
        r->origin = strdup(file);
        if (!r->origin) {
-               acpid_log(LOG_ERR, "strdup(): %s\n", strerror(errno));
+               acpid_log(LOG_ERR, "strdup(): %s", strerror(errno));
                free_rule(r);
                fclose(fp);
                return NULL;
@@ -275,12 +275,12 @@
                /* quick parse */
                n = sscanf(p, "%63[^=\n]=%255[^\n]", key, val);
                if (n != 2) {
-                       acpid_log(LOG_WARNING, "can't parse %s at line %d\n",
+                       acpid_log(LOG_WARNING, "can't parse %s at line %d",
                            file, line);
                        continue;
                }
                if (acpid_debug >= 3) {
-                       acpid_log(LOG_DEBUG, "    key=\"%s\" val=\"%s\"\n",
+                       acpid_log(LOG_DEBUG, "    key=\"%s\" val=\"%s\"",
                            key, val);
                }
                /* handle the parsed line */
@@ -288,7 +288,7 @@
                        int rv;
                        r->event = malloc(sizeof(regex_t));
                        if (!r->event) {
-                               acpid_log(LOG_ERR, "malloc(): %s\n",
+                               acpid_log(LOG_ERR, "malloc(): %s",
                                        strerror(errno));
                                free_rule(r);
                                fclose(fp);
@@ -298,14 +298,14 @@
                        if (rv) {
                                char rbuf[128];
                                regerror(rv, r->event, rbuf, sizeof(rbuf));
-                               acpid_log(LOG_ERR, "regcomp(): %s\n", rbuf);
+                               acpid_log(LOG_ERR, "regcomp(): %s", rbuf);
                                free_rule(r);
                                fclose(fp);
                                return NULL;
                        }
                } else if (!strcasecmp(key, "action")) {
                        if (check_escapes(val) < 0) {
-                               acpid_log(LOG_ERR, "can't load file %s\n",
+                               acpid_log(LOG_ERR, "can't load file %s",
                                    file);
                                free_rule(r);
                                fclose(fp);
@@ -313,7 +313,7 @@
                        }
                        r->action.cmd = strdup(val);
                        if (!r->action.cmd) {
-                               acpid_log(LOG_ERR, "strdup(): %s\n",
+                               acpid_log(LOG_ERR, "strdup(): %s",
                                        strerror(errno));
                                free_rule(r);
                                fclose(fp);
@@ -321,13 +321,13 @@
                        }
                } else {
                        acpid_log(LOG_WARNING,
-                           "unknown option '%s' in %s at line %d\n",
+                           "unknown option '%s' in %s at line %d",
                            key, file, line);
                        continue;
                }
        }
        if (!r->event || !r->action.cmd) {
-               acpid_log(LOG_INFO, "skipping incomplete file %s\n", file);
+               acpid_log(LOG_INFO, "skipping incomplete file %s", file);
                free_rule(r);
                fclose(fp);
                return NULL;
@@ -343,7 +343,7 @@
        struct rule *r;
        int nrules = 0;
 
-       acpid_log(LOG_NOTICE, "client connected from %s\n", origin);
+       acpid_log(LOG_NOTICE, "client connected from %s", origin);
 
        r = parse_client(clifd);
        if (r) {
@@ -352,7 +352,7 @@
                nrules++;
        }
 
-       acpid_log(LOG_INFO, "%d client rule%s loaded\n",
+       acpid_log(LOG_INFO, "%d client rule%s loaded",
            nrules, (nrules == 1)?"":"s");
 
        return 0;
@@ -373,7 +373,7 @@
        r->action.fd = client;
        r->event = malloc(sizeof(regex_t));
        if (!r->event) {
-               acpid_log(LOG_ERR, "malloc(): %s\n", strerror(errno));
+               acpid_log(LOG_ERR, "malloc(): %s", strerror(errno));
                free_rule(r);
                return NULL;
        }
@@ -381,7 +381,7 @@
        if (rv) {
                char buf[128];
                regerror(rv, r->event, buf, sizeof(buf));
-               acpid_log(LOG_ERR, "regcomp(): %s\n", buf);
+               acpid_log(LOG_ERR, "regcomp(): %s", buf);
                free_rule(r);
                return NULL;
        }
@@ -431,7 +431,7 @@
 
        r = malloc(sizeof(*r));
        if (!r) {
-               acpid_log(LOG_ERR, "malloc(): %s\n", strerror(errno));
+               acpid_log(LOG_ERR, "malloc(): %s", strerror(errno));
                return NULL;
        }
 
@@ -477,7 +477,7 @@
        r = poll(&pfd, 1, 0);
 
        if (r < 0) {
-               acpid_log(LOG_ERR, "poll(): %s\n", strerror(errno));
+               acpid_log(LOG_ERR, "poll(): %s", strerror(errno));
                return 0;
        }
 
@@ -499,7 +499,7 @@
                        struct ucred cred;
                        /* closed */
                        acpid_log(LOG_NOTICE,
-                           "client %s has disconnected\n", p->origin);
+                           "client %s has disconnected", p->origin);
                        delist_rule(&client_list, p);
                        ud_get_peercred(p->action.fd, &cred);
                        if (cred.uid != 0) {
@@ -539,7 +539,7 @@
                                /* a match! */
                                if (logevents) {
                                        acpid_log(LOG_INFO,
-                                           "rule from %s matched\n",
+                                           "rule from %s matched",
                                            p->origin);
                                }
                                nrules++;
@@ -549,13 +549,13 @@
                                        do_client_rule(p, event);
                                } else {
                                        acpid_log(LOG_WARNING,
-                                           "unknown rule type: %d\n",
+                                           "unknown rule type: %d",
                                            p->type);
                                }
                        } else {
                                if (acpid_debug >= 3 && logevents) {
                                        acpid_log(LOG_INFO,
-                                           "rule from %s did not match\n",
+                                           "rule from %s did not match",
                                            p->origin);
                                }
                        }
@@ -566,7 +566,7 @@
        unlock_rules();
 
        if (logevents) {
-               acpid_log(LOG_INFO, "%d total rule%s matched\n",
+               acpid_log(LOG_INFO, "%d total rule%s matched",
                        nrules, (nrules == 1)?"":"s");
        }
 
@@ -592,7 +592,7 @@
 lock_rules(void)
 {
        if (acpid_debug >= 4) {
-               acpid_log(LOG_DEBUG, "blocking signals for rule lock\n");
+               acpid_log(LOG_DEBUG, "blocking signals for rule lock");
        }
        sigprocmask(SIG_BLOCK, signals_handled(), NULL);
 }
@@ -601,7 +601,7 @@
 unlock_rules(void)
 {
        if (acpid_debug >= 4) {
-               acpid_log(LOG_DEBUG, "unblocking signals for rule lock\n");
+               acpid_log(LOG_DEBUG, "unblocking signals for rule lock");
        }
        sigprocmask(SIG_UNBLOCK, signals_handled(), NULL);
 }
@@ -620,14 +620,14 @@
        pid = fork();
        switch (pid) {
        case -1:
-               acpid_log(LOG_ERR, "fork(): %s\n", strerror(errno));
+               acpid_log(LOG_ERR, "fork(): %s", strerror(errno));
                return -1;
        case 0: /* child */
                /* parse the commandline, doing any substitutions needed */
                action = parse_cmd(rule->action.cmd, event);
                if (logevents) {
                        acpid_log(LOG_INFO,
-                           "executing action \"%s\"\n", action);
+                           "executing action \"%s\"", action);
                }
 
                /* reset signals */
@@ -643,7 +643,7 @@
                }
                execl("/bin/sh", "/bin/sh", "-c", action, NULL);
                /* should not get here */
-               acpid_log(LOG_ERR, "execl(): %s\n", strerror(errno));
+               acpid_log(LOG_ERR, "execl(): %s", strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -655,13 +655,13 @@
 
        if (logevents) {
                if (WIFEXITED(status)) {
-                       acpid_log(LOG_INFO, "action exited with status %d\n",
+                       acpid_log(LOG_INFO, "action exited with status %d",
                            WEXITSTATUS(status));
                } else if (WIFSIGNALED(status)) {
-                       acpid_log(LOG_INFO, "action exited on signal %d\n",
+                       acpid_log(LOG_INFO, "action exited on signal %d",
                            WTERMSIG(status));
                } else {
-                       acpid_log(LOG_INFO, "action exited with status %d\n",
+                       acpid_log(LOG_INFO, "action exited with status %d",
                            status);
                }
        }
@@ -676,7 +676,7 @@
        int client = rule->action.fd;
 
        if (logevents) {
-               acpid_log(LOG_INFO, "notifying client %s\n", rule->origin);
+               acpid_log(LOG_INFO, "notifying client %s", rule->origin);
        }
 
        r = safe_write(client, event, strlen(event));
@@ -684,7 +684,7 @@
                struct ucred cred;
                /* closed */
                acpid_log(LOG_NOTICE,
-                   "client %s has disconnected\n", rule->origin);
+                   "client %s has disconnected", rule->origin);
                delist_rule(&client_list, rule);
                ud_get_peercred(rule->action.fd, &cred);
                if (cred.uid != 0) {
@@ -723,9 +723,8 @@
        } while (ttl < len && ntries);
 
        if (!ntries) {
-               /* crap */
                if (acpid_debug >= 2) {
-                       acpid_log(LOG_ERR, "uh-oh! safe_write() timed out\n");
+                       acpid_log(LOG_ERR, "safe_write() timed out");
                }
                return r;
        }
@@ -762,7 +761,7 @@
                buf[i++] = *p++;
        }
        if (acpid_debug >= 2) {
-               acpid_log(LOG_DEBUG, "expanded \"%s\" -> \"%s\"\n", cmd, buf);
+               acpid_log(LOG_DEBUG, "expanded \"%s\" -> \"%s\"", cmd, buf);
        }
 
        return buf;
@@ -781,11 +780,11 @@
                        p++;
                        if (!*p) {
                                acpid_log(LOG_WARNING,
-                                   "invalid escape at EOL\n");
+                                   "invalid escape at EOL");
                                return -1;
                        } else if (*p != '%' && *p != 'e') {
                                acpid_log(LOG_WARNING,
-                                   "invalid escape \"%%%c\"\n", *p);
+                                   "invalid escape \"%%%c\"", *p);
                                r = -1;
                        }
                }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/acpid-2.0.8/inotify_handler.c 
new/acpid-2.0.9/inotify_handler.c
--- old/acpid-2.0.8/inotify_handler.c   2010-03-28 15:13:25.000000000 +0200
+++ new/acpid-2.0.9/inotify_handler.c   2011-03-12 17:20:42.000000000 +0100
@@ -49,25 +49,25 @@
 
        bytes = read(fd, &eventbuf.buffer, sizeof(eventbuf.buffer));
 
-       acpid_log(LOG_DEBUG, "inotify read bytes: %d\n", bytes);
+       acpid_log(LOG_DEBUG, "inotify read bytes: %d", bytes);
 
        /* eof is not expected */       
        if (bytes == 0)
        {
-               acpid_log(LOG_WARNING, "inotify fd eof encountered\n");
+               acpid_log(LOG_WARNING, "inotify fd eof encountered");
                return;
        }
        else if (bytes < 0)
        {
                /* EINVAL means buffer wasn't big enough.  See inotify(7). */
-               acpid_log(LOG_ERR, "inotify read error: %s (%d)\n",
+               acpid_log(LOG_ERR, "inotify read error: %s (%d)",
                        strerror(errno), errno);
-               acpid_log(LOG_ERR, "disconnecting from inotify\n");
+               acpid_log(LOG_ERR, "disconnecting from inotify");
                delete_connection(fd);
                return;
        }
 
-       acpid_log(LOG_DEBUG, "inotify name len: %d\n", eventbuf.event.len);
+       acpid_log(LOG_DEBUG, "inotify name len: %d", eventbuf.event.len);
 
        /* if a name is included */
        if (eventbuf.event.len > 0)
@@ -80,7 +80,7 @@
                strcat(devname, "/");
                strncat(devname, eventbuf.event.name, dnsize - strlen(devname) 
- 1);
                
-               acpid_log(LOG_DEBUG, "inotify about to open: %s\n", devname);
+               acpid_log(LOG_DEBUG, "inotify about to open: %s", devname);
 
                open_inputfile(devname);
        }
@@ -98,24 +98,24 @@
        fd = inotify_init();
        
        if (fd < 0) {
-               acpid_log(LOG_ERR, "inotify_init() failed: %s (%d)\n",
+               acpid_log(LOG_ERR, "inotify_init() failed: %s (%d)",
                        strerror(errno), errno);
                return;
        }
        
-       acpid_log(LOG_DEBUG, "inotify fd: %d\n", fd);
+       acpid_log(LOG_DEBUG, "inotify fd: %d", fd);
 
        /* watch for new files being created in /dev/input */
        wd = inotify_add_watch(fd, ACPID_INPUTLAYERDIR, IN_CREATE);
 
        if (wd < 0) {
-               acpid_log(LOG_ERR, "inotify_add_watch() failed: %s (%d)\n",
+               acpid_log(LOG_ERR, "inotify_add_watch() failed: %s (%d)",
                        strerror(errno), errno);
                close(fd);                      
                return;
        }
 
-       acpid_log(LOG_DEBUG, "inotify wd: %d\n", wd);
+       acpid_log(LOG_DEBUG, "inotify wd: %d", wd);
 
        /* add a connection to the list */
        c.fd = fd;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/acpid-2.0.8/input_layer.c 
new/acpid-2.0.9/input_layer.c
--- old/acpid-2.0.8/input_layer.c       2010-11-05 18:05:08.000000000 +0100
+++ new/acpid-2.0.9/input_layer.c       2011-03-12 17:22:34.000000000 +0100
@@ -191,7 +191,7 @@
        nbytes = read(fd, &event, sizeof(event));
 
        if (nbytes == 0) {
-               acpid_log(LOG_WARNING, "input layer connection closed\n");
+               acpid_log(LOG_WARNING, "input layer connection closed");
                exit(EXIT_FAILURE);
        }
        
@@ -200,16 +200,16 @@
                if (errno == EINTR)
                        return;
                if (errno == ENODEV) {
-                       acpid_log(LOG_WARNING, "input device has been 
disconnected\n");
+                       acpid_log(LOG_WARNING, "input device has been 
disconnected");
                        delete_connection(fd);
                        return;
                }
-               acpid_log(LOG_ERR, "input layer read error: %s (%d)\n",
+               acpid_log(LOG_ERR, "input layer read error: %s (%d)",
                        strerror(errno), errno);
                if (++nerrs >= ACPID_MAX_ERRS) {
                        acpid_log(LOG_ERR,
                                "too many errors reading "
-                               "input layer - aborting\n");
+                               "input layer - aborting");
                        exit(EXIT_FAILURE);
                }
                return;
@@ -220,7 +220,7 @@
        
        if (nbytes != sizeof(event)) {
                acpid_log(LOG_WARNING, "input layer unexpected length: "
-                       "%d   expected: %d\n", nbytes, sizeof(event));
+                       "%d   expected: %d", nbytes, sizeof(event));
                return;
        }
 
@@ -235,21 +235,21 @@
                if (logevents) {
                        acpid_log(LOG_INFO,
                                "lockfile present, not processing "
-                               "input layer event \"%s\"\n", str);
+                               "input layer event \"%s\"", str);
                }
                return;
        }
 
        if (logevents)
                acpid_log(LOG_INFO,
-                       "received input layer event \"%s\"\n", str);
+                       "received input layer event \"%s\"", str);
        
        /* send the event off to the handler */
        acpid_handle_event(str);
 
        if (logevents)
                acpid_log(LOG_INFO,
-                       "completed input layer event \"%s\"\n", str);
+                       "completed input layer event \"%s\"", str);
 }
 
 #define BITS_PER_LONG (sizeof(long) * 8)
@@ -314,7 +314,7 @@
                }
 
                acpid_log(LOG_DEBUG, "input layer %s "
-                       "opened successfully\n", filename);
+                       "opened successfully", filename);
 
                /* add a connection to the list */
                c.fd = fd;
@@ -350,7 +350,7 @@
        }
 
        if (!success)
-               acpid_log(LOG_ERR, "cannot open input layer\n");
+               acpid_log(LOG_ERR, "cannot open input layer");
 
        globfree(&globbuf);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/acpid-2.0.8/netlink.c new/acpid-2.0.9/netlink.c
--- old/acpid-2.0.8/netlink.c   2010-03-28 15:54:44.000000000 +0200
+++ new/acpid-2.0.9/netlink.c   2011-03-12 17:24:24.000000000 +0100
@@ -57,7 +57,7 @@
        /* if this message doesn't have the proper family ID, drop it */
        if (msg->nlmsg_type != acpi_ids_getfamily()) {
                if (logevents) {
-                       acpid_log(LOG_INFO, "wrong netlink family ID.\n");
+                       acpid_log(LOG_INFO, "wrong netlink family ID.");
                }
                return;
        }
@@ -66,7 +66,7 @@
 
        if (len < 0) {
                acpid_log(LOG_WARNING,
-                       "wrong netlink controller message len: %d\n", len);
+                       "wrong netlink controller message len: %d", len);
                return;
        }
 
@@ -90,21 +90,21 @@
                        if (logevents) {
                                acpid_log(LOG_INFO,
                                        "lockfile present, not processing "
-                                       "netlink event \"%s\"\n", buf);
+                                       "netlink event \"%s\"", buf);
                        }
                        return;
                }
 
                if (logevents)
                        acpid_log(LOG_INFO,
-                               "received netlink event \"%s\"\n", buf);
+                               "received netlink event \"%s\"", buf);
 
                /* send the event off to the handler */
                acpid_handle_event(buf);
 
                if (logevents)
                        acpid_log(LOG_INFO,
-                               "completed netlink event \"%s\"\n", buf);
+                               "completed netlink event \"%s\"", buf);
        }
 }
 
@@ -148,25 +148,25 @@
                if (errno == EINTR)
                        return;
                
-               acpid_log(LOG_ERR, "netlink read error: %s (%d)\n",
+               acpid_log(LOG_ERR, "netlink read error: %s (%d)",
                        strerror(errno), errno);
                if (++nerrs >= ACPID_MAX_ERRS) {
                        acpid_log(LOG_ERR,
                                "too many errors reading via "
-                               "netlink - aborting\n");
+                               "netlink - aborting");
                        exit(EXIT_FAILURE);
                }
                return;
        }
        /* if an orderly shutdown has occurred, we're done */
        if (status == 0) {
-               acpid_log(LOG_WARNING, "netlink connection closed\n");
+               acpid_log(LOG_WARNING, "netlink connection closed");
                exit(EXIT_FAILURE);
        }
        /* check to see if the address length has changed */
        if (msg.msg_namelen != sizeof(nladdr)) {
                acpid_log(LOG_WARNING, "netlink unexpected length: "
-                       "%d   expected: %d\n", msg.msg_namelen, sizeof(nladdr));
+                       "%d   expected: %d", msg.msg_namelen, sizeof(nladdr));
                return;
        }
        
@@ -177,11 +177,11 @@
 
                if (l < 0  ||  len > status) {
                        if (msg.msg_flags & MSG_TRUNC) {
-                               acpid_log(LOG_WARNING, "netlink msg truncated 
(1)\n");
+                               acpid_log(LOG_WARNING, "netlink msg truncated 
(1)");
                                return;
                        }
                        acpid_log(LOG_WARNING,
-                               "malformed netlink msg, length %d\n", len);
+                               "malformed netlink msg, length %d", len);
                        return;
                }
 
@@ -192,11 +192,11 @@
                h = (struct nlmsghdr*)((char*)h + NLMSG_ALIGN(len));
        }
        if (msg.msg_flags & MSG_TRUNC) {
-               acpid_log(LOG_WARNING, "netlink msg truncated (2)\n");
+               acpid_log(LOG_WARNING, "netlink msg truncated (2)");
                return;
        }
        if (status) {
-               acpid_log(LOG_WARNING, "netlink remnant of size %d\n", status);
+               acpid_log(LOG_WARNING, "netlink remnant of size %d", status);
                return;
        }
 
@@ -209,7 +209,7 @@
 nl_mgrp(__u32 group)
 {
        if (group > 31) {
-               acpid_log(LOG_ERR, "Unexpected group number %d\n", group);
+               acpid_log(LOG_ERR, "Unexpected group number %d", group);
                return 0;
        }
        return group ? (1 << (group - 1)) : 0;
@@ -223,11 +223,11 @@
        /* open the appropriate netlink socket for input */
        if (rtnl_open_byproto(
                &rth, nl_mgrp(acpi_ids_getgroup()), NETLINK_GENERIC) < 0) {
-               acpid_log(LOG_ERR, "cannot open generic netlink socket\n");
+               acpid_log(LOG_ERR, "cannot open generic netlink socket");
                return;
        }
 
-       acpid_log(LOG_DEBUG, "netlink opened successfully\n");
+       acpid_log(LOG_DEBUG, "netlink opened successfully");
 
        /* add a connection to the list */
        c.fd = rth.fd;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/acpid-2.0.8/proc.c new/acpid-2.0.9/proc.c
--- old/acpid-2.0.8/proc.c      2010-11-05 18:05:01.000000000 +0100
+++ new/acpid-2.0.9/proc.c      2011-03-12 17:25:40.000000000 +0100
@@ -48,7 +48,7 @@
                if (logevents  &&  event != NULL) {
                        acpid_log(LOG_INFO,
                                "lockfile present, not processing "
-                               "event \"%s\"\n", event);
+                               "event \"%s\"", event);
                }
                return;
        }
@@ -57,23 +57,23 @@
        if (event) {
                if (logevents) {
                        acpid_log(LOG_INFO,
-                                 "procfs received event \"%s\"\n", event);
+                                 "procfs received event \"%s\"", event);
                }
                acpid_handle_event(event);
                if (logevents) {
                        acpid_log(LOG_INFO,
-                               "procfs completed event \"%s\"\n", event);
+                               "procfs completed event \"%s\"", event);
                }
        } else if (errno == EPIPE) {
                acpid_log(LOG_WARNING,
-                       "events file connection closed\n");
+                       "events file connection closed");
                exit(EXIT_FAILURE);
        } else {
                static int nerrs;
                if (++nerrs >= ACPID_MAX_ERRS) {
                        acpid_log(LOG_ERR,
                                "too many errors reading "
-                               "events file - aborting\n");
+                               "events file - aborting");
                        exit(EXIT_FAILURE);
                }
        }
@@ -89,9 +89,9 @@
        if (fd < 0) {
                if (errno == ENOENT) {
                        acpid_log(LOG_DEBUG, "Deprecated %s was not found.  "
-                               "Trying netlink and the input layer...\n", 
eventfile);
+                               "Trying netlink and the input layer...", 
eventfile);
                } else {
-                       acpid_log(LOG_ERR, "can't open %s: %s (%d)\n", 
eventfile, 
+                       acpid_log(LOG_ERR, "can't open %s: %s (%d)", eventfile, 
                                strerror(errno), errno);
                }
                return -1;
@@ -102,7 +102,7 @@
        descriptors. */
     fcntl(fd, F_SETFD, FD_CLOEXEC);
 
-       acpid_log(LOG_DEBUG, "proc fs opened successfully\n");
+       acpid_log(LOG_DEBUG, "proc fs opened successfully");
 
        /* add a connection to the list */
        c.fd = fd;
@@ -132,7 +132,7 @@
                        r = read(fd, buf+i, 1);
                        if (r < 0 && errno != EINTR) {
                                /* we should do something with the data */
-                               acpid_log(LOG_ERR, "read(): %s\n",
+                               acpid_log(LOG_ERR, "read(): %s",
                                        strerror(errno));
                                return NULL;
                        } else if (r == 0) {
@@ -176,7 +176,7 @@
                /* ??? This memory is leaked since it is never freed */
                buf = realloc(buf, buflen);
                if (!buf) {
-                       acpid_log(LOG_ERR, "malloc(%d): %s\n",
+                       acpid_log(LOG_ERR, "malloc(%d): %s",
                                buflen, strerror(errno));
                        return NULL;
                }
@@ -186,7 +186,7 @@
                        r = read(fd, buf+i, 1);
                        if (r < 0 && errno != EINTR) {
                                /* we should do something with the data */
-                               acpid_log(LOG_ERR, "read(): %s\n",
+                               acpid_log(LOG_ERR, "read(): %s",
                                        strerror(errno));
                                return NULL;
                        } else if (r == 0) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/acpid-2.0.8/sock.c new/acpid-2.0.9/sock.c
--- old/acpid-2.0.8/sock.c      2010-03-28 16:28:54.000000000 +0200
+++ new/acpid-2.0.9/sock.c      2011-03-24 20:54:55.000000000 +0100
@@ -42,6 +42,7 @@
 /* the number of non-root clients that are connected */
 int non_root_clients;
 
+/* accept a new client connection */
 static void
 process_sock(int fd)
 {
@@ -53,32 +54,49 @@
        /* accept and add to our lists */
        cli_fd = ud_accept(fd, &creds);
        if (cli_fd < 0) {
-               acpid_log(LOG_ERR, "can't accept client: %s\n",
+               acpid_log(LOG_ERR, "can't accept client: %s",
                          strerror(errno));
                accept_errors++;
                if (accept_errors >= 5) {
-                       acpid_log(LOG_ERR, "giving up\n");
+                       acpid_log(LOG_ERR, "giving up");
                        clean_exit_with_status(EXIT_FAILURE);
                }
                return;
        }
        accept_errors = 0;
-       /* This check against clientmax is from the non-netlink 1.0.10.  */
+
+       /* don't allow too many non-root clients  */
        if (creds.uid != 0 && non_root_clients >= clientmax) {
                close(cli_fd);
-               acpid_log(LOG_ERR,
-                   "too many non-root clients\n");
+               acpid_log(LOG_ERR, "too many non-root clients");
                return;
        }
        if (creds.uid != 0) {
                non_root_clients++;
        }
-       fcntl(cli_fd, F_SETFD, FD_CLOEXEC);
-       snprintf(buf, sizeof(buf)-1, "%d[%d:%d]",
+
+    /* don't leak fds when execing */
+       if (fcntl(cli_fd, F_SETFD, FD_CLOEXEC) < 0) {
+               close(cli_fd);
+               acpid_log(LOG_ERR, "fcntl() on client for FD_CLOEXEC: %s", 
+            strerror(errno));
+               return;
+    }
+
+    /* don't allow clients to block this */
+    if (fcntl(cli_fd, F_SETFL, O_NONBLOCK) < 0) {
+               close(cli_fd);
+               acpid_log(LOG_ERR, "fcntl() on client for O_NONBLOCK: %s", 
+            strerror(errno));
+               return;
+    }
+
+    snprintf(buf, sizeof(buf)-1, "%d[%d:%d]",
                 creds.pid, creds.uid, creds.gid);
        acpid_add_client(cli_fd, buf);
 }
 
+/* set up the socket for client connections */
 void
 open_sock()
 {
@@ -87,26 +105,52 @@
 
        fd = ud_create_socket(socketfile);
        if (fd < 0) {
-               acpid_log(LOG_ERR, "can't open socket %s: %s\n",
+               acpid_log(LOG_ERR, "can't open socket %s: %s",
                        socketfile, strerror(errno));
                exit(EXIT_FAILURE);
        }
-       fcntl(fd, F_SETFD, FD_CLOEXEC);
-       chmod(socketfile, socketmode);
+
+    /* don't leak fds when execing */
+    if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) {
+               close(fd);
+               acpid_log(LOG_ERR, "fcntl() on socket %s for FD_CLOEXEC: %s", 
+            socketfile, strerror(errno));
+               return;
+    }
+
+    /* avoid a potential hang */
+    if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) {
+               close(fd);
+               acpid_log(LOG_ERR, "fcntl() on socket %s for O_NONBLOCK: %s", 
+            socketfile, strerror(errno));
+               return;
+    }
+
+       if (chmod(socketfile, socketmode) < 0) {
+               close(fd);
+               acpid_log(LOG_ERR, "chmod() on socket %s: %s", 
+            socketfile, strerror(errno));
+               return;
+    }
+
+    /* if we need to change the socket's group, do so */
        if (socketgroup) {
                struct group *gr;
                struct stat buf;
-               gr = getgrnam(socketgroup);
+
+        gr = getgrnam(socketgroup);
                if (!gr) {
-                       acpid_log(LOG_ERR, "group %s does not exist\n", 
socketgroup);
+                       acpid_log(LOG_ERR, "group %s does not exist", 
socketgroup);
                        exit(EXIT_FAILURE);
                }
                if (stat(socketfile, &buf) < 0) {
-                       acpid_log(LOG_ERR, "can't stat %s\n", socketfile);
+                       acpid_log(LOG_ERR, "can't stat %s: %s", 
+                socketfile, strerror(errno));
                        exit(EXIT_FAILURE);
                }
                if (chown(socketfile, buf.st_uid, gr->gr_gid) < 0) {
-                       acpid_log(LOG_ERR, "can't chown: %s\n", 
strerror(errno));
+                       acpid_log(LOG_ERR, "can't chown %s: %s", 
+                socketfile, strerror(errno));
                        exit(EXIT_FAILURE);
                }
        }
@@ -116,4 +160,3 @@
        c.process = process_sock;
        add_connection(&c);
 }
-


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Remember to have fun...

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to