This is the mail archive of the cygwin mailing list for the Cygwin project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Subject says it all. To restate: pid = fork(); exec*(...); /* child exits normally by itself, no waitpid() called yet. */ kill( pid, 0 ) is expected to return 0, while it returns -1. Attached program reproduces the issue. Best regards. -- Huginn GCS d? s: a C++$() UBLS++++$ P++ L++++$ E--- W+(-) N++ w-- O M- V- PS+ PE++ Y PGP- t--- 5-- X- R !tv b++ DI+++ D+ G e* h r++ y**
#include <stdio.h> #include <unistd.h> #include <signal.h> #include <stdlib.h> #include <errno.h> #include <string.h> int main( int argc, char** argv ) { int errKill = 0; int errWaitPid = 0; int status = 0; int pid = fork(); if ( ! pid ) { execlp( "sleep", "sleep", "1", NULL ); printf( "error\n" ); abort(); } else if ( pid > 0 ) { sleep( 2 ); /* errWaitPid = waitpid( pid, &status, WNOHANG | WUNTRACED | WCONTINUED ); printf( "errWaitPid = %d, errno = %d, comment = %s\n", errWaitPid, errno, strerror( errno ) ); */ errKill = kill( pid, 0 ); printf( "errKill = %d, errno = %d, comment = %s\n", errKill, errno, strerror( errno ) ); } else { printf( "error\n" ); } return ( 0 ); }
Attachment:
cygcheck.out
Description: Text document
-- 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
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |