main:Fix segfault when socket does not exist
This commit is contained in:
parent
778d75396e
commit
1545e3140d
@ -79,13 +79,16 @@ sqlite3* get_db() {
|
||||
|
||||
void notify_change() {
|
||||
char* socket_path = get_socket_path();
|
||||
FILE* fp = fopen(socket_path, "r");
|
||||
|
||||
int pid;
|
||||
fscanf(fp, "%d", &pid); // Trigger IN_ACCESS
|
||||
(void)pid;
|
||||
if (access(socket_path, F_OK) == 0) {
|
||||
FILE* fp = fopen(socket_path, "r");
|
||||
|
||||
fclose(fp);
|
||||
int pid;
|
||||
fscanf(fp, "%d", &pid); // Trigger IN_ACCESS
|
||||
(void)pid;
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
free(socket_path);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user