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;
@ -87,6 +88,8 @@ void notify_change() {
fclose(fp); fclose(fp);
} }
free(socket_path);
}
int add_task(task_t t) { int add_task(task_t t) {