Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ds4.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ enum {
};

static int g_ds4_lock_fd = -1;
static const char *g_ds4_lock_path = NULL;

#if defined(__GNUC__) || defined(__clang__)
#define DS4_MAYBE_UNUSED __attribute__((unused))
Expand Down Expand Up @@ -15449,6 +15450,9 @@ static void ds4_release_instance_lock(void) {
if (g_ds4_lock_fd >= 0) {
close(g_ds4_lock_fd);
g_ds4_lock_fd = -1;
if (g_ds4_lock_path) {
(void)unlink(g_ds4_lock_path);
}
}
}

Expand Down Expand Up @@ -15495,6 +15499,7 @@ static void ds4_acquire_instance_lock(void) {
}
dprintf(fd, "%ld\n", (long)getpid());
g_ds4_lock_fd = fd;
g_ds4_lock_path = path;
atexit(ds4_release_instance_lock);
}

Expand Down