Skip to content

Commit

Permalink
fixing missed chdir return
Browse files Browse the repository at this point in the history
  • Loading branch information
will-rowe committed Jan 7, 2020
1 parent 1a03b1d commit 535e8f6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/daemonize.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,11 @@ int daemonize(char *name, char *path, char *outfile, char *errfile, char *infile
umask(0);

//change to path directory
chdir(path);
if (chdir(path) != 0)
{
fprintf(stderr, "error: failed to change directory during daemonisation\n");
exit(EXIT_FAILURE);
}

//close all open file descriptors
int fd;
Expand Down

0 comments on commit 535e8f6

Please sign in to comment.