[PATCH] tests: don't assume getdtablesize () <= 10000000
Eric Blake
eblake@redhat.com
Wed Sep 25 20:04:00 GMT 2013
On 09/25/2013 10:25 AM, Eric Blake wrote:
> On 09/25/2013 09:04 AM, Christopher Faylor wrote:
>>
>> Since you've previously made modifications in this area, why not supply
>> a simple patch?
>
> Ah - the joys of having write access. Yes, I'll post a patch for
> discussion.
What am I getting myself into?
$ cat foo.c
#include <stdio.h
#include <unistd.h>
int main(int argc, char **argv) {
printf ("%d ", getdtablesize());
if (argc > 1)
printf ("%d ", dup2 (0, getdtablesize() - 1));
printf ("%d\n", dup2 (0, getdtablesize()));
return 0;
}
$ gcc -o foo -Wall -g foo.c
$ ./foo
Segmentation fault (core dumped)
$ strace -o /dev/null ./foo
256 256
Heisenbug! The very act of trying to trace it makes it disappear :(
$ ./foo 1
Segmentation fault (core dumped)
$ strace -o /dev/null ./foo 1
22687 [main] foo 2020 open_stackdumpfile: Dumping stack trace to
foo.exe.stackdump
probably some off-by-one at a boundary case, but not as simple as I had
originally hoped it would be.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20130925/757bdb40/attachment.sig>
More information about the Cygwin
mailing list