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]

dup2() dumps core on corner case


Detected by gnulib's unit tests.  STC:

$ cat foo.c
#include <unistd.h>
int main() {
  return dup2(0, -1);
}
$ gcc -o foo -g -Wall foo.c
$ ./foo
Segmentation fault (core dumped)

cygwin 1.7.17-1

Running under gdb shows:
      4 [main] foo 1220 exception::handle: Exception:
STATUS_ACCESS_VIOLATION
    702 [main] foo 1220 open_stackdumpfile: Dumping stack trace to
foo.exe.stackdump

Program received signal SIGSEGV, Segmentation fault.
0x610e9407 in dup2 () from /usr/bin/cygwin1.dll

Expected results should be a normal failure with EBADF in errno.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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