aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2020-08-04 01:44:27 +0200
committerKenny Levinsen <kl@kl.wtf>2020-08-04 01:44:27 +0200
commit68d95e66b395ef94f30936fb45b9f86028876ca2 (patch)
tree4ca71bbf9cfefbb82f1f2b3e4cd5ce8365b8bfc3
parent55cbe043e23dc2e8ed8b398034cd16b0156bba70 (diff)
seatd: Unlink default seatd socket on startup
-rw-r--r--seatd/seatd.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/seatd/seatd.c b/seatd/seatd.c
index d0ff7e1..7cc7c71 100644
--- a/seatd/seatd.c
+++ b/seatd/seatd.c
@@ -5,6 +5,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
+#include <sys/stat.h>
#include <sys/un.h>
#include "client.h"
@@ -37,6 +38,11 @@ int main(int argc, char *argv[]) {
char *path = getenv("SEATD_SOCK");
if (path == NULL) {
path = "/run/seatd.sock";
+ struct stat st;
+ if (stat(path, &st) == 0) {
+ log_info("removing leftover seatd socket");
+ unlink(path);
+ }
}
if (server_listen(&server, path) == -1) {