From 51e75198fa09e683bd79de67cb82402373a79b3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Mon, 20 Oct 2008 17:41:08 +0000 Subject: [PATCH] There is no point in releasing a lock on a file which we've unlinked and are about to close, so don't. As a bonus, pidfile_remove(3) will now work with an fcntl(2)-based flopen(3). --- lib/libutil/pidfile.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/libutil/pidfile.c b/lib/libutil/pidfile.c index ecf0fac48f1a..6b99936f7aa2 100644 --- a/lib/libutil/pidfile.c +++ b/lib/libutil/pidfile.c @@ -231,10 +231,6 @@ _pidfile_remove(struct pidfh *pfh, int freeit) if (unlink(pfh->pf_path) == -1) error = errno; - if (flock(pfh->pf_fd, LOCK_UN) == -1) { - if (error == 0) - error = errno; - } if (close(pfh->pf_fd) == -1) { if (error == 0) error = errno;