ztatus

[discontinued] Status bar for dwm, and simple notification daemon.
git clone https://noxz.tech/git/ztatus.git
Log | Files | LICENSE

commit: 19e06ec1141b9e2fa8fbda28f13db6e02bcc2d3d
parent: 3009d69fd9eccfeb6a7985e46df8bd69119ab88f
author: Chris Noxz <chris@noxz.tech>
date:   Tue, 31 Mar 2020 10:13:08 +0200
[bug] fix fifo unlink issue when trying to launch multiple instances
Mztatus.c8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/ztatus.c b/ztatus.c
@@ -61,12 +61,14 @@ run(void)
 	struct timeval tv;
 	char *status_line = NULL;
 
-	unlink(FIFO_PATH);
-
-	/* setup, or fail */
+	/* only allow one instance of ztatus */
 	if ((pid = get_pid()) != -1)
 		return die("error: an instance of %s is already running (PID: %d)\n",
 		           PNAME, pid);
+
+	unlink(FIFO_PATH);
+
+	/* setup, or fail */
 	if ((mknod(FIFO_PATH, S_IFIFO | 0600, 0)) < 0)
 		return die("error: cannot create fifo '%s'\n", FIFO_PATH);
 	if ((fifofd = open(FIFO_PATH, O_RDWR | O_NONBLOCK)) < 0)