Is error status properly set in cygwin?
Try compiling theprogram, and then run
./test_program ; echo "Status: $?"
If you get "Status: 0", then no error is indicated by running the
program..
Also, the return statement should return 1 to indicate an error in case
exec fails..
Hmm.. also it is not very nice to start programs having
stdin/stdout/stderr closed. You SHOULD link these filedescriptors to
something, for example /dev/null.
/Henrik
Robert Collins wrote:
>
> Hi,
> Under early (until tonights/tomorrow nights snapshot :=) ) versions of
> Cygwin, execvp() dies when fd's 0,1 and 2 are closed before it's called. (I
> emailed about about that a short while ago). I've provided a patch to the
> cygwin maintainers and it will be in the next release (due soon) so it's one
> less cygwin-specific line in the code...
> However I think we should check for old installations and prevent compiling
> with a warning...
>
> The following code will stackdump on broken installs
> int main (int argc, char **argv)
> {
> int i;
>
> for(i=0;i<10;i++)
> close(i);
> execvp("ls","");
>
> return 0;
> }
>
> However I have never written m4 scripts before, and I'm having some trouble
> getting it to test. The AC_TRY_RUN is returning to the ok branch, not the
> failed branch...
>
> Any suggestions, or should I just make it a README item?
>
> Rob
Received on Sat Jul 15 2000 - 15:54:18 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:32 MST