Skip to content

Commit

Permalink
core: remove pid file on shutdown
Browse files Browse the repository at this point in the history
Signed-off-by: Yuxuan Shui <[email protected]>
  • Loading branch information
yshui committed Oct 24, 2020
1 parent b6987e0 commit 7301fe9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/picom.c
Original file line number Diff line number Diff line change
Expand Up @@ -2403,6 +2403,7 @@ int main(int argc, char **argv) {
// Main loop
bool quit = false;
int ret_code = 0;
char *pid_file = NULL;

do {
Display *dpy = XOpenDisplay(NULL);
Expand Down Expand Up @@ -2445,6 +2446,9 @@ int main(int argc, char **argv) {
}
session_run(ps_g);
quit = ps_g->quit;
if (quit && ps_g->o.write_pid_path) {
pid_file = strdup(ps_g->o.write_pid_path);
}
session_destroy(ps_g);
free(ps_g);
ps_g = NULL;
Expand All @@ -2454,6 +2458,10 @@ int main(int argc, char **argv) {
} while (!quit);

free(config_file);
if (pid_file) {
log_trace("remove pid file %s", pid_file);
unlink(pid_file);
}

log_deinit_tls();

Expand Down

0 comments on commit 7301fe9

Please sign in to comment.