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]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]