Skip to content
Snippets Groups Projects
Commit b7031075 authored by Marek Vavruša's avatar Marek Vavruša
Browse files

Merge branch 'add_chdir_check' of /git/repositories/knot

parents 105617dd 6c72ba4f
No related branches found
No related tags found
No related merge requests found
...@@ -268,7 +268,8 @@ int main(int argc, char **argv) ...@@ -268,7 +268,8 @@ int main(int argc, char **argv)
log_server_info("PID stored in '%s'\n", pidf); log_server_info("PID stored in '%s'\n", pidf);
if ((cwd = malloc(PATH_MAX)) != NULL) if ((cwd = malloc(PATH_MAX)) != NULL)
cwd = getcwd(cwd, PATH_MAX); cwd = getcwd(cwd, PATH_MAX);
chdir("/"); if (chdir("/") != 0)
log_server_warning("Server can't change working directory.\n");
} else { } else {
log_server_info("Server started in foreground, PID = %ld\n", pid); log_server_info("Server started in foreground, PID = %ld\n", pid);
log_server_info("Server running without PID file.\n"); log_server_info("Server running without PID file.\n");
...@@ -397,7 +398,8 @@ int main(int argc, char **argv) ...@@ -397,7 +398,8 @@ int main(int argc, char **argv)
/* Return to original working directory. */ /* Return to original working directory. */
if (cwd) { if (cwd) {
chdir(cwd); if (chdir(cwd) != 0)
log_server_warning("Server can't change working directory.\n");
free(cwd); free(cwd);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment