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>
return -1;
}
+ ret = pipe(fd);
+ if (ret != 0) {
+ return -1;
+ }
+
argv = talloc_array(ectx, const char *, 4);
if (argv == NULL) {
+ close(fd[0]);
+ close(fd[1]);
return -1;
}
argv[3] = NULL;
if (argv[2] == NULL) {
+ close(fd[0]);
+ close(fd[1]);
talloc_free(argv);
return -1;
}
DEBUG(DEBUG_NOTICE,
("Starting event daemon %s %s %s\n", argv[0], argv[1], argv[2]));
- ret = pipe(fd);
- if (ret != 0) {
- return -1;
- }
-
pid = ctdb_fork(ctdb);
if (pid == -1) {
close(fd[0]);