summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2018-08-27 14:44:24 +1000
committerStefan Metzmacher <metze@samba.org>2018-09-05 13:31:40 +0200
commiteb3d91ed61ee5ab3afa862a001e0ca2db9793698 (patch)
tree238139ace05be71eb26506ec0c5cc0849acd8358 /ctdb
parenta4021fb56d8891728ae6c4ed84f79f66d6d9ef92 (diff)
downloadsamba-eb3d91ed61ee5ab3afa862a001e0ca2db9793698.tar.gz
ctdb-daemon: Open eventd pipe earlier
The pipe will soon be needed earlier, so initialise it earlier. Ensure the file descriptors are closed on error. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13592 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit c446ae5e1382d5e32c33ce92243daf6b4338e15a)
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/server/eventscript.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/ctdb/server/eventscript.c b/ctdb/server/eventscript.c
index 74f132c0e80..02924a7f471 100644
--- a/ctdb/server/eventscript.c
+++ b/ctdb/server/eventscript.c
@@ -175,8 +175,15 @@ int ctdb_start_eventd(struct ctdb_context *ctdb)
return -1;
}
+ ret = pipe(fd);
+ if (ret != 0) {
+ return -1;
+ }
+
argv = talloc_array(ectx, const char *, 14);
if (argv == NULL) {
+ close(fd[0]);
+ close(fd[1]);
return -1;
}
@@ -201,6 +208,8 @@ int ctdb_start_eventd(struct ctdb_context *ctdb)
argv[13] = NULL;
if (argv[6] == NULL) {
+ close(fd[0]);
+ close(fd[1]);
talloc_free(argv);
return -1;
}
@@ -210,11 +219,6 @@ int ctdb_start_eventd(struct ctdb_context *ctdb)
argv[0], argv[1], argv[2], argv[3], argv[4], argv[5],
argv[6], argv[7], argv[8], argv[9], argv[10]));
- ret = pipe(fd);
- if (ret != 0) {
- return -1;
- }
-
pid = ctdb_fork(ctdb);
if (pid == -1) {
close(fd[0]);