public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* 0417 snapshot: exec() fails on /proc/self/exe
@ 2011-04-19 22:38 Andy Koppe
  2011-04-20  2:06 ` Eric Blake
  2011-04-20 11:59 ` Andy Koppe
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Koppe @ 2011-04-19 22:38 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-04-20  7:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-19 22:38 0417 snapshot: exec() fails on /proc/self/exe Andy Koppe
2011-04-20  2:06 ` Eric Blake
2011-04-20 11:59 ` Andy Koppe
2011-04-20 13:16   ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).