File acpid-1.0.6-fix-fd-leak.diff of Package acpid
Index: b/acpid.c
===================================================================
--- a/acpid.c
+++ b/acpid.c
@@ -244,10 +244,11 @@ main(int argc, char **argv)
if (cli_fd < 0) {
acpid_log(LOG_ERR, "can't accept client: %s\n",
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);
}
}
Index: b/event.c
===================================================================
--- a/event.c
+++ b/event.c
@@ -316,10 +316,11 @@ parse_file(const char *file)
if (acpid_debug) {
acpid_log(LOG_DEBUG, "skipping incomplete file %s\n",
file);
}
free_rule(r);
+ fclose(fp);
return NULL;
}
fclose(fp);
return r;