Skip to content

Commit accd859

Browse files
committed
Merge pull request #12 from jfsmig/master
std{out,err} reopened when redirecting to syslog
2 parents 1833fba + e6ccc92 commit accd859

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

main/gridinit.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1950,18 +1950,19 @@ main(int argc, char ** args)
19501950
if (is_gridinit_running(sock_path)) {
19511951
FATAL("A gridinit is probably already running,"
19521952
" someone listens to UNIX sock path [%s]", sock_path);
1953-
g_printerr("A gridinit is probably already running,"
1954-
" someone listens to UNIX sock path [%s]\n", sock_path);
19551953
goto label_exit;
19561954
}
19571955

1956+
if (flag_daemon || *syslog_id) {
1957+
freopen( "/dev/null", "w", stdout);
1958+
freopen( "/dev/null", "w", stderr);
1959+
}
1960+
19581961
if (flag_daemon) {
19591962
if (0 != daemon(1,0)) {
19601963
FATAL("Failed to daemonize : %s", strerror(errno));
19611964
goto label_exit;
19621965
}
1963-
freopen( "/dev/null", "w", stdout);
1964-
freopen( "/dev/null", "w", stderr);
19651966
write_pid_file();
19661967
}
19671968

0 commit comments

Comments
 (0)