diff options
author | Volker Lendecke <vl@samba.org> | 2021-02-15 11:38:18 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2021-03-16 17:09:32 +0000 |
commit | cf43f331be818c6253bb45fcfa89327a3c858188 (patch) | |
tree | 30714d20487df55fc93b414c1c34fb01986196d0 /ctdb | |
parent | 9614273aa3d0d7c7113d25b2204ebb292405c7a8 (diff) | |
download | samba-cf43f331be818c6253bb45fcfa89327a3c858188.tar.gz |
lib: Make pidfile_path_create() return the existing PID on conflict
Use F_GETLK to get the lock holder PID, this is more accurate than
reading the file contents: A conflicting process might not have
written its PID yet. Also, F_GETLK easily allows to do a retry if the
lock holder just died.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/common/pidfile.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ctdb/common/pidfile.c b/ctdb/common/pidfile.c index e78542d5f2f..47589f4b083 100644 --- a/ctdb/common/pidfile.c +++ b/ctdb/common/pidfile.c @@ -54,7 +54,7 @@ int pidfile_context_create(TALLOC_CTX *mem_ctx, const char *pidfile, pid_ctx->pid = getpid(); - ret = pidfile_path_create(pid_ctx->pidfile, &fd); + ret = pidfile_path_create(pid_ctx->pidfile, &fd, NULL); if (ret != 0) { return ret; } |