main:Fix segfault when socket does not exist

This commit is contained in:
augustin64 2023-07-17 09:45:38 +02:00
parent 778d75396e
commit 1545e3140d

View File

@ -79,6 +79,7 @@ sqlite3* get_db() {
void notify_change() { void notify_change() {
char* socket_path = get_socket_path(); char* socket_path = get_socket_path();
if (access(socket_path, F_OK) == 0) {
FILE* fp = fopen(socket_path, "r"); FILE* fp = fopen(socket_path, "r");
int pid; int pid;
@ -86,6 +87,8 @@ void notify_change() {
(void)pid; (void)pid;
fclose(fp); fclose(fp);
}
free(socket_path);
} }