Accepting request 151577 from home:msmeissn:branches:openSUSE:12.3
- fixed the file descriptor leak correctly (bnc#786096,bnc#802345) OBS-URL: https://build.opensuse.org/request/show/151577 OBS-URL: https://build.opensuse.org/package/show/Base:System/cronie?expand=0&rev=113
This commit is contained in:
parent
05bd668973
commit
997afe46d3
@ -1,25 +1,42 @@
|
|||||||
Index: cronie-1.4.8/src/do_command.c
|
|
||||||
===================================================================
|
diff --git a/src/cron.c b/src/cron.c
|
||||||
--- cronie-1.4.8.orig/src/do_command.c
|
index 7dc2958..69261c1 100644
|
||||||
+++ cronie-1.4.8/src/do_command.c
|
--- a/src/cron.c
|
||||||
@@ -69,6 +69,7 @@ static int child_process(entry * e, user
|
+++ b/src/cron.c
|
||||||
int stdin_pipe[2], stdout_pipe[2];
|
@@ -87,22 +87,21 @@ void set_cron_watched(int fd) {
|
||||||
char *input_data, *usernm, *mailto, *mailfrom;
|
for (i = 0; i < sizeof (wd) / sizeof (wd[0]); ++i) {
|
||||||
int children = 0;
|
int w;
|
||||||
+ int i = 3, open_max = -1;
|
|
||||||
pid_t pid = getpid();
|
|
||||||
struct sigaction sa;
|
|
||||||
|
|
||||||
@@ -154,6 +155,12 @@ static int child_process(entry * e, user
|
- if (open(watchpaths[i], O_RDONLY | O_NONBLOCK, 0) != -1) {
|
||||||
*p = '\0';
|
- w = inotify_add_watch(fd, watchpaths[i],
|
||||||
|
- IN_CREATE | IN_CLOSE_WRITE | IN_ATTRIB | IN_MODIFY | IN_MOVED_TO |
|
||||||
|
- IN_MOVED_FROM | IN_MOVE_SELF | IN_DELETE | IN_DELETE_SELF);
|
||||||
|
- if (w < 0) {
|
||||||
|
- if (wd[i] != -1) {
|
||||||
|
- log_it("CRON", pid, "This directory or file can't be watched",
|
||||||
|
- watchpaths[i], errno);
|
||||||
|
- log_it("CRON", pid, "INFO", "running without inotify support", 0);
|
||||||
|
- }
|
||||||
|
- inotify_enabled = 0;
|
||||||
|
- set_cron_unwatched(fd);
|
||||||
|
- return;
|
||||||
|
+ w = inotify_add_watch(fd, watchpaths[i],
|
||||||
|
+ IN_CREATE | IN_CLOSE_WRITE | IN_ATTRIB | IN_MODIFY | IN_MOVED_TO |
|
||||||
|
+ IN_MOVED_FROM | IN_MOVE_SELF | IN_DELETE | IN_DELETE_SELF);
|
||||||
|
+ if (w < 0) {
|
||||||
|
+ if (wd[i] != -1) {
|
||||||
|
+ log_it("CRON", pid, "This directory or file can't be watched",
|
||||||
|
+ watchpaths[i], errno);
|
||||||
|
+ log_it("CRON", pid, "INFO", "running without inotify support",
|
||||||
|
+ 0);
|
||||||
|
}
|
||||||
|
- wd[i] = w;
|
||||||
|
+ inotify_enabled = 0;
|
||||||
|
+ set_cron_unwatched(fd);
|
||||||
|
+ return;
|
||||||
|
}
|
||||||
|
+ wd[i] = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ open_max = sysconf(_SC_OPEN_MAX);
|
if (!inotify_enabled) {
|
||||||
+ if (open_max < 0)
|
|
||||||
+ open_max = 1024;
|
|
||||||
+ for (i = STDERR + 1; i < open_max; ++i)
|
|
||||||
+ close(i);
|
|
||||||
+
|
|
||||||
|
|
||||||
/* fork again, this time so we can exec the user's command.
|
|
||||||
*/
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Feb 7 12:19:58 UTC 2013 - meissner@suse.com
|
||||||
|
|
||||||
|
- fixed the file descriptor leak correctly (bnc#786096,bnc#802345)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Feb 4 14:20:48 UTC 2013 - fcrozat@suse.com
|
Mon Feb 4 14:20:48 UTC 2013 - fcrozat@suse.com
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user