Pi66

sta
minimal & simple status monitoring app.
git clone https://git.pi66.xyz/sta

← back to log

fix: return after run_client() success

author: pi66
date: 2026-05-21 19:27
hash: b13c8c429dbea35d313352e7141be2f452b5135f

Diffstat:

M

sta.c
7 +++++++++++++++++-------------
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/sta.c b/sta.c
index 36a11d2..b95ac27 100644
--- a/sta.c
+++ b/sta.c
@@ -235,11 +235,12 @@ int main(int argc, char const *argv[])

    if (access(SOCKET_PATH, F_OK) == 0) {
        run_client(argc, argv, &addr, sock);
-   } else {
-       die("ERROR: server not running (no socket at " SOCKET_PATH ")");
+       goto clean_up;
    }

-   close(sock);
+   warn("ERROR: server not running (no socket at " SOCKET_PATH ")");
    unlink(SOCKET_PATH);
+clean_up:
+   close(sock);
    return 0;
 }