1 Submitted By: Matthew Burgess <matthew@linuxfromscratch.org>
3 Initial Package Version: 3.1.5
4 Upstream Status: From Upstream
5 Origin: http://lists.gnu.org/archive/html/bug-gnu-utils/2005-08/msg00047.html
6 Description: Fixes a bug which causes gawk to segfault when operating on a non-existent file.
8 diff -Naur gawk-3.1.5.orig/io.c gawk-3.1.5/io.c
9 --- gawk-3.1.5.orig/io.c 2005-07-26 18:07:43.000000000 +0000
10 +++ gawk-3.1.5/io.c 2005-09-24 14:43:13.771380264 +0000
11 @@ -2480,9 +2480,12 @@
15 + int iop_malloced = FALSE;
19 emalloc(iop, IOBUF *, sizeof(IOBUF), "iop_alloc");
20 + iop_malloced = TRUE;
22 memset(iop, '\0', sizeof(IOBUF));
28 if (iop->fd == INVALID_HANDLE) {
36 iop->readsize = iop->size = optimal_bufsize(iop->fd, & sbuf);
38 if (do_lint && S_ISREG(sbuf.st_mode) && sbuf.st_size == 0)
39 - lintwarn(_("data file `%s' is empty"), name);
40 + lintwarn(_("data file `%s' is empty"), name);
42 iop->count = iop->scanoff = 0;
43 emalloc(iop->buf, char *, iop->size += 2, "iop_alloc");