source:
scripts/patches/gawk-3.1.5-segfault_fix-1.patch@
0547e59
Last change on this file since 0547e59 was dd6636b, checked in by , 19 years ago | |
---|---|
|
|
File size: 1.3 KB |
-
gawk-3.1.5
Submitted By: Matthew Burgess <matthew@linuxfromscratch.org> Date: 2005-09-24 Initial Package Version: 3.1.5 Upstream Status: From Upstream Origin: http://lists.gnu.org/archive/html/bug-gnu-utils/2005-08/msg00047.html Description: Fixes a bug which causes gawk to segfault when operating on a non-existent file. diff -Naur gawk-3.1.5.orig/io.c gawk-3.1.5/io.c
old new 2480 2480 { 2481 2481 struct stat sbuf; 2482 2482 struct open_hook *oh; 2483 int iop_malloced = FALSE; 2483 2484 2484 if (iop == NULL) 2485 if (iop == NULL) { 2485 2486 emalloc(iop, IOBUF *, sizeof(IOBUF), "iop_alloc"); 2487 iop_malloced = TRUE; 2488 } 2486 2489 memset(iop, '\0', sizeof(IOBUF)); 2487 2490 iop->flag = 0; 2488 2491 iop->fd = fd; … … 2495 2498 } 2496 2499 2497 2500 if (iop->fd == INVALID_HANDLE) { 2498 free(iop); 2501 if (iop_malloced) 2502 free(iop); 2499 2503 return NULL; 2500 2504 } 2501 2505 if (isatty(iop->fd)) … … 2503 2507 iop->readsize = iop->size = optimal_bufsize(iop->fd, & sbuf); 2504 2508 iop->sbuf = sbuf; 2505 2509 if (do_lint && S_ISREG(sbuf.st_mode) && sbuf.st_size == 0) 2506 2510 lintwarn(_("data file `%s' is empty"), name); 2507 2511 errno = 0; 2508 2512 iop->count = iop->scanoff = 0; 2509 2513 emalloc(iop->buf, char *, iop->size += 2, "iop_alloc");
Note:
See TracBrowser
for help on using the repository browser.