[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 3.1.6 system() fails when at the ulimit of open files
From: |
Aharon Robbins |
Subject: |
Re: 3.1.6 system() fails when at the ulimit of open files |
Date: |
Wed, 14 Oct 2009 23:29:32 +0200 |
OK, ok, ok. This is what I get for trying to debug late at night.
It's a real bug. Patch is below. Thanks to Chris for reporting it.
Arnold
> From: Dave B <address@hidden>
> To: address@hidden
> Subject: Re: 3.1.6 system() fails when at the ulimit of open files
> Date: Wed, 14 Oct 2009 21:35:41 +0100
>
> On Wednesday 14 October 2009, Aharon Robbins wrote:
>
> > Hi. I just tried this with gawk 3.1.7 and 3.1.6 on my Linux system
> > and I cannot reproduce it.
> >[snip]
> > $ yes|head -2000|gawk-3.1.6 '{print "hi" > ("z/"z++)}END{system("echo
> > hiho;date")}'
> > $ ls z | wc -l
> > 2000
>
> Where's the output of the system() call there?
>
> --
> D.
Wed Oct 14 23:25:47 2009 Arnold D. Robbins <address@hidden>
* io.c (redirect): When opening a file, set the close-on-exec flag.
Thanks to Chris Pearson <address@hidden> for the bug report.
Index: io.c
===================================================================
RCS file: /d/mongo/cvsrep/gawk-stable/io.c,v
retrieving revision 1.23
diff -u -r1.23 io.c
--- io.c 9 Jul 2009 19:54:38 -0000 1.23
+++ io.c 14 Oct 2009 21:24:12 -0000
@@ -740,6 +740,7 @@
else
#endif
rp->fp = fdopen(fd, (const char
*) mode);
+ os_close_on_exec(fileno(rp->fp), str,
"file", "");
rp->mode = (const char *) mode;
/* don't leak file descriptors */
if (rp->fp == NULL)