diff options
author | dec05eba <dec05eba@protonmail.com> | 2025-07-06 20:35:46 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2025-07-06 20:38:18 +0200 |
commit | a78cefc65b1de37b293b210e4dec1c9f39d914fb (patch) | |
tree | 8cc7e839bedbf72c9e8c8f12204fd87029ae3d08 /src/Rpc.cpp | |
parent | a0d1de55d7c704d796e63e5b13e5d68fd4eb61ea (diff) |
Add better single instance detection (use rpc fifo file existence with unlink to detect process instead of pidof gsr-ui)
Diffstat (limited to 'src/Rpc.cpp')
-rw-r--r-- | src/Rpc.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Rpc.cpp b/src/Rpc.cpp index 3eec98d..803a4dc 100644 --- a/src/Rpc.cpp +++ b/src/Rpc.cpp @@ -32,7 +32,7 @@ namespace gsr { fclose(file); if(!fifo_filepath.empty()) - remove(fifo_filepath.c_str()); + unlink(fifo_filepath.c_str()); } bool Rpc::create(const char *name) { @@ -44,15 +44,16 @@ namespace gsr { char fifo_filepath_tmp[PATH_MAX]; get_runtime_filepath(fifo_filepath_tmp, sizeof(fifo_filepath_tmp), name); fifo_filepath = fifo_filepath_tmp; - remove(fifo_filepath.c_str()); + unlink(fifo_filepath.c_str()); if(mkfifo(fifo_filepath.c_str(), 0600) != 0) { fprintf(stderr, "Error: mkfifo failed, error: %s, %s\n", strerror(errno), fifo_filepath.c_str()); + fifo_filepath.clear(); return false; } if(!open_filepath(fifo_filepath.c_str())) { - remove(fifo_filepath.c_str()); + unlink(fifo_filepath.c_str()); fifo_filepath.clear(); return false; } |