Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Wed Aug 3 09:13:55 CEST 2016 on sn-devel-144
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;
return '3';
}
+ *outfd = fd;
+
return '0';
}
char result;
int ppid;
const char *file = NULL;
+ int fd = -1;
progname = argv[0];
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;
}