0417 snapshot: exec() fails on /proc/self/exe

Andy Koppe andy.koppe@gmail.com
Tue Apr 19 22:38:00 GMT 2011


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



More information about the Cygwin mailing list