git: 3f2f6bb8f7b5 - main - hastd: Remove pidfile on exit

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Mon, 02 Nov 2026 12:39:02 UTC
The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=3f2f6bb8f7b562276bffd04a9ae4c05a351b4435

commit 3f2f6bb8f7b562276bffd04a9ae4c05a351b4435
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-11-02 12:30:42 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-11-02 12:30:42 +0000

    hastd: Remove pidfile on exit
    
    Make hastd remove its pidfile before exit after catching a signal or a
    stop control message, not just on failure to start.
    
    MFC after:      1 week
    Reviewed by:    ngie
    Differential Revision:  https://reviews.freebsd.org/D60192
---
 sbin/hastd/hastd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sbin/hastd/hastd.c b/sbin/hastd/hastd.c
index 5d90ddc8aff9..1569dc9f8697 100644
--- a/sbin/hastd/hastd.c
+++ b/sbin/hastd/hastd.c
@@ -1173,6 +1173,7 @@ main_loop(void)
 	}
 	terminate_workers();
 	proto_close(cfg->hc_controlconn);
+	(void)pidfile_remove(pfh);
 	exit(EX_OK);
 }