summaryrefslogtreecommitdiffstats
path: root/package/gawk/gawk-3.1.5-core.patch
diff options
context:
space:
mode:
Diffstat (limited to 'package/gawk/gawk-3.1.5-core.patch')
-rw-r--r--package/gawk/gawk-3.1.5-core.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/package/gawk/gawk-3.1.5-core.patch b/package/gawk/gawk-3.1.5-core.patch
new file mode 100644
index 000000000..17cd188c4
--- /dev/null
+++ b/package/gawk/gawk-3.1.5-core.patch
@@ -0,0 +1,31 @@
+fix an ugly core on a simple script
+
+http://lists.gnu.org/archive/html/bug-gnu-utils/2005-08/msg00040.html
+http://lists.gnu.org/archive/html/bug-gnu-utils/2005-08/msg00047.html
+
+--- gawk/io.c
++++ gawk/io.c
+@@ -2480,9 +2480,12 @@
+ {
+ struct stat sbuf;
+ struct open_hook *oh;
++ int iop_malloced = FALSE;
+
+- if (iop == NULL)
++ if (iop == NULL) {
+ emalloc(iop, IOBUF *, sizeof(IOBUF), "iop_alloc");
++ iop_malloced = TRUE;
++ }
+ memset(iop, '\0', sizeof(IOBUF));
+ iop->flag = 0;
+ iop->fd = fd;
+@@ -2495,7 +2498,8 @@
+ }
+
+ if (iop->fd == INVALID_HANDLE) {
+- free(iop);
++ if (iop_malloced)
++ free(iop);
+ return NULL;
+ }
+ if (isatty(iop->fd))