main: rewrite some error messages
This commit is contained in:
parent
f282856c72
commit
539ef3f770
1 changed files with 5 additions and 5 deletions
10
main.c
10
main.c
|
@ -290,7 +290,7 @@ write_lockfile(void)
|
||||||
|
|
||||||
out = fopen(pidfile, "w");
|
out = fopen(pidfile, "w");
|
||||||
if (!out) {
|
if (!out) {
|
||||||
LOG_FATAL("could not open lockfile %s for writing", pidfile);
|
LOG_FATAL("Could not open %s : %s", pidfile, strerror(errno));
|
||||||
} else {
|
} else {
|
||||||
fprintf(out, "%d\n", (int)getpid());
|
fprintf(out, "%d\n", (int)getpid());
|
||||||
fclose(out);
|
fclose(out);
|
||||||
|
@ -307,14 +307,14 @@ go_daemon(void)
|
||||||
/* Create pipe which will the daemon use to notify the grandparent
|
/* Create pipe which will the daemon use to notify the grandparent
|
||||||
when it's initialised or send an error message */
|
when it's initialised or send an error message */
|
||||||
if (pipe(pipefd)) {
|
if (pipe(pipefd)) {
|
||||||
LOG_FATAL("Could not detach, pipe failed : %s", strerror(errno));
|
LOG_FATAL("pipe() failed : %s", strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Does this preserve existing signal handlers? */
|
/* Does this preserve existing signal handlers? */
|
||||||
pid = fork();
|
pid = fork();
|
||||||
|
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
LOG_FATAL("Could not detach, fork failed : %s", strerror(errno));
|
LOG_FATAL("fork() failed : %s", strerror(errno));
|
||||||
} else if (pid > 0) {
|
} else if (pid > 0) {
|
||||||
/* In the 'grandparent' */
|
/* In the 'grandparent' */
|
||||||
char message[1024];
|
char message[1024];
|
||||||
|
@ -340,7 +340,7 @@ go_daemon(void)
|
||||||
pid = fork();
|
pid = fork();
|
||||||
|
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
LOG_FATAL("Could not detach, fork failed : %s", strerror(errno));
|
LOG_FATAL("fork() failed : %s", strerror(errno));
|
||||||
} else if (pid > 0) {
|
} else if (pid > 0) {
|
||||||
exit(0); /* In the 'parent' */
|
exit(0); /* In the 'parent' */
|
||||||
} else {
|
} else {
|
||||||
|
@ -348,7 +348,7 @@ go_daemon(void)
|
||||||
|
|
||||||
/* Change current directory to / */
|
/* Change current directory to / */
|
||||||
if (chdir("/") < 0) {
|
if (chdir("/") < 0) {
|
||||||
LOG_FATAL("Could not chdir to / : %s", strerror(errno));
|
LOG_FATAL("chdir() failed : %s", strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't keep stdin/out/err from before. But don't close
|
/* Don't keep stdin/out/err from before. But don't close
|
||||||
|
|
Loading…
Reference in a new issue