--- acpid-1.0.6/acpid.c.fd 2007-11-23 14:12:36.000000000 +0100 +++ acpid-1.0.6/acpid.c 2007-11-23 14:13:03.000000000 +0100 @@ -246,6 +246,7 @@ main(int argc, char **argv) strerror(errno)); continue; } + fcntl(cli_fd, F_SETFD, FD_CLOEXEC); snprintf(buf, sizeof(buf)-1, "%d[%d:%d]", creds.pid, creds.uid, creds.gid); acpid_add_client(cli_fd, buf); @@ -397,7 +398,7 @@ open_log(void) int log_opts; /* open /dev/null */ - nullfd = open("/dev/null", O_RDONLY, 0640); + nullfd = open("/dev/null", O_RDONLY); if (nullfd < 0) { fprintf(stderr, "%s: can't open %s: %s\n", progname, "/dev/null", strerror(errno)); --- acpid-1.0.6/event.c.fd 2007-05-25 06:26:09.000000000 +0200 +++ acpid-1.0.6/event.c 2007-11-23 14:12:36.000000000 +0100 @@ -318,6 +318,7 @@ parse_file(const char *file) file); } free_rule(r); + fclose(fp); return NULL; } fclose(fp); @@ -667,7 +668,7 @@ parse_cmd(const char *cmd, const char *e i = 0; memset(buf, 0, sizeof(buf)); - while (i < (sizeof(buf)-1)) { + while ((size_t)i < (sizeof(buf)-1)) { if (*p == '%') { p++; if (*p == 'e') {