Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Tue, 10 Feb 2004 10:30:18 -0600 From: roywestfall AT houston DOT rr DOT com Subject: Recently changed behavior for daemons To: cygwin AT cygwin DOT com Cc: roywestfall AT houston DOT rr DOT com Reply-to: roywestfall AT houston DOT rr DOT com Message-id: <175d2217261e.17261e175d22@texas.rr.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-language: en Content-transfer-encoding: 7BIT Content-disposition: inline X-Virus-Scanned: Symantec AntiVirus Scan Engine Note-from-DJ: This may be spam I recently upgraded to version 1.5.7-1 Since then, when I run a daemon (i.e. a program that forks, closes file descriptors, chdirs to /, and calls setsid) from a cygwin (non-X) command shell, I am unable to close the cygwin window. I've tried doing the standard daemon things, and calling the daemon() function, both behave the same. Below is some sample code to demonstrate, using either method, pass any command line argument to call daemon(). This program simply sleeps for 2 minutes then exits. If I run it, then exit bash, my window doesn't close. Forcing the window to close terminates the program. This behavior has changed since the upgrade. Roy Westfall roywestfallhoustonrrcom #include #include int main(int ac, char* av[]) { int i = 0; if (ac > 1) { daemon(0,0); } else { if (fork()) return 0; for (i = getdtablesize()-1; i >= 0; i--) close(i); open("/dev/null",O_RDONLY); dup(open("/dev/null",O_WRONLY)); chdir("/"); setsid(); } sleep(120); return 0; } -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/