pass HOST_ variables, not BUILD_
[buildroot.git] / package / gawk / gawk-3.1.5-core.patch
blob17cd188c484f46166eeef7744b8a565e485aaeb3
1 fix an ugly core on a simple script
3 http://lists.gnu.org/archive/html/bug-gnu-utils/2005-08/msg00040.html
4 http://lists.gnu.org/archive/html/bug-gnu-utils/2005-08/msg00047.html
6 --- gawk/io.c
7 +++ gawk/io.c
8 @@ -2480,9 +2480,12 @@
10 struct stat sbuf;
11 struct open_hook *oh;
12 + int iop_malloced = FALSE;
14 - if (iop == NULL)
15 + if (iop == NULL) {
16 emalloc(iop, IOBUF *, sizeof(IOBUF), "iop_alloc");
17 + iop_malloced = TRUE;
18 + }
19 memset(iop, '\0', sizeof(IOBUF));
20 iop->flag = 0;
21 iop->fd = fd;
22 @@ -2495,7 +2498,8 @@
25 if (iop->fd == INVALID_HANDLE) {
26 - free(iop);
27 + if (iop_malloced)
28 + free(iop);
29 return NULL;
31 if (isatty(iop->fd))