This is the mail archive of the
cygwin
mailing list for the Cygwin project.
0417 snapshot: exec() fails on /proc/self/exe
- From: Andy Koppe <andy dot koppe at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Tue, 19 Apr 2011 21:16:37 +0100
- Subject: 0417 snapshot: exec() fails on /proc/self/exe
With the latest snapshot, exec() fails on /proc/self/exe:
$ cat test.c
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
int main(int argc, char *argv[])
{
if (argc > 1 && !fork()) {
execl("/proc/self/exe", argv[0], (char *)0);
puts(strerror(errno));
}
return 0;
}
$ cc test.c
$ ./a bla
Bad file descriptor
With 1.7.9, it prints nothing, which is the expected behaviour.
Looking at POSIX, EBADF is not a valid errno for exec().
(The argument in the test is there as a way to stop it from becoming a
fork bomb.)
Andy
--
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