lib: Make pidfile_path_create() return the existing PID on conflict
authorVolker Lendecke <vl@samba.org>
Mon, 15 Feb 2021 10:38:18 +0000 (11:38 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 16 Mar 2021 17:09:32 +0000 (17:09 +0000)
commitcf43f331be818c6253bb45fcfa89327a3c858188
tree30714d20487df55fc93b414c1c34fb01986196d0
parent9614273aa3d0d7c7113d25b2204ebb292405c7a8
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>
ctdb/common/pidfile.c
lib/util/pidfile.c
lib/util/pidfile.h