This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: [ANNOUNCEMENT] Update: mintty 2.1.2
- From: Thomas Wolff <towo at towo dot net>
- To: cygwin at cygwin dot com
- Date: Sat, 25 Jul 2015 00:03:48 +0200
- Subject: Re: [ANNOUNCEMENT] Update: mintty 2.1.2
- Authentication-results: sourceware.org; auth=none
- References: <announce dot 55B1677D dot 5080303 at towo dot net> <63a08c60771faffa23bc1c029235301d dot squirrel at oude-webmail dot xs4all dot nl> <55B22422 dot 6000601 at towo dot net> <d9ef810e0ad325a9b51f641a10a06f0b dot squirrel at oude-webmail dot xs4all dot nl>
Am 24.07.2015 um 15:18 schrieb Houder:
Hi Thomas,
Maybe setsid() should not be called if fork() fails...
Could you try this please:
if (daemonize && !isatty(0)) {
int pid = fork();
if (pid > 0) exit(0); // exit parent process
if (pid == 0) setsid(); // detach child process
if (pid < 0) {
error("could not detach from caller");
exit(9);
}
}
Hint: source code of setsid.c -- util-linux package)
... or maybe the parent thread should not exit immediately but wait:
if (daemonize && !isatty(0)) {
#include <sys/wait.h>
int status;
int pid = fork();
if (pid > 0) {
waitpid(pid, &status, 0);
exit(0);
}
setsid();
}
Can you please try both alternatives?
Thomas
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple