From: Olaf Wintermann Date: Fri, 19 Sep 2025 14:54:56 +0000 (+0200) Subject: cleanup instance socket when exiting the application X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=f787400da71887a01cd0360ad620b4c8e7a79ce9;p=uwplayer.git cleanup instance socket when exiting the application --- diff --git a/application/settings.c b/application/settings.c index 2503d9a..a2dc541 100644 --- a/application/settings.c +++ b/application/settings.c @@ -33,6 +33,7 @@ #include #include +#include #include "main.h" @@ -268,6 +269,14 @@ char *InstanceFilePath(Display *dp) { } int ConnectToInstance(const char *path) { + struct stat s; + if(stat(path, &s)) { + if(errno != ENOENT) { + fprintf(stderr, "cannot stat file %s: %s", path, strerror(errno)); + } + return -1; + } + int fd = socket(AF_UNIX, SOCK_STREAM, 0); if(!fd) { return -1; diff --git a/application/window.c b/application/window.c index 4d43cc3..b72539f 100644 --- a/application/window.c +++ b/application/window.c @@ -632,6 +632,7 @@ static void FileOpenCB(Widget w, void *udata, void *cdata) { static void FileQuitCB(Widget w, void *udata, void *cdata) { WindowClosePlayer(main_window); + ShutdownInstanceSocket(XtDisplay(w)); ApplicationExit(); }