summaryrefslogtreecommitdiff
path: root/ctdb/server
diff options
context:
space:
mode:
Diffstat (limited to 'ctdb/server')
-rw-r--r--ctdb/server/ctdb_mutex_fcntl_helper.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/ctdb/server/ctdb_mutex_fcntl_helper.c b/ctdb/server/ctdb_mutex_fcntl_helper.c
index 93c7f6236dd..06c2205d496 100644
--- a/ctdb/server/ctdb_mutex_fcntl_helper.c
+++ b/ctdb/server/ctdb_mutex_fcntl_helper.c
@@ -27,7 +27,7 @@
static char *progname = NULL;
-static char fcntl_lock(const char *file)
+static char fcntl_lock(const char *file, int *outfd)
{
int fd;
struct flock lock;
@@ -62,6 +62,8 @@ static char fcntl_lock(const char *file)
return '3';
}
+ *outfd = fd;
+
return '0';
}
@@ -70,6 +72,7 @@ int main(int argc, char *argv[])
char result;
int ppid;
const char *file = NULL;
+ int fd = -1;
progname = argv[0];
@@ -81,10 +84,14 @@ int main(int argc, char *argv[])
ppid = getppid();
file = argv[1];
- result = fcntl_lock(file);
+ result = fcntl_lock(file, &fd);
sys_write(STDOUT_FILENO, &result, 1);
ctdb_wait_for_process_to_exit(ppid);
+ if (fd != -1) {
+ close(fd);
+ }
+
return 0;
}