source: clfs-sysroot/patches/gawk-3.1.5-segfault_fix-1.patch@ f1630e0

Last change on this file since f1630e0 was 8f3d581, checked in by Joe Ciccone <jciccone@…>, 18 years ago

Add all of the patches needed for clfs-sysroot.

  • Property mode set to 100644
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  
    24802480{
    24812481        struct stat sbuf;
    24822482        struct open_hook *oh;
     2483        int iop_malloced = FALSE;
    24832484
    2484         if (iop == NULL)
     2485        if (iop == NULL) {
    24852486                emalloc(iop, IOBUF *, sizeof(IOBUF), "iop_alloc");
     2487                iop_malloced = TRUE;
     2488        }
    24862489        memset(iop, '\0', sizeof(IOBUF));
    24872490        iop->flag = 0;
    24882491        iop->fd = fd;
     
    24952498        }
    24962499
    24972500        if (iop->fd == INVALID_HANDLE) {
    2498                 free(iop);
     2501                if (iop_malloced)
     2502                        free(iop);
    24992503                return NULL;
    25002504        }
    25012505        if (isatty(iop->fd))
     
    25032507        iop->readsize = iop->size = optimal_bufsize(iop->fd, & sbuf);
    25042508        iop->sbuf = sbuf;
    25052509        if (do_lint && S_ISREG(sbuf.st_mode) && sbuf.st_size == 0)
    2506                         lintwarn(_("data file `%s' is empty"), name);
     2510                lintwarn(_("data file `%s' is empty"), name);
    25072511        errno = 0;
    25082512        iop->count = iop->scanoff = 0;
    25092513        emalloc(iop->buf, char *, iop->size += 2, "iop_alloc");
Note: See TracBrowser for help on using the repository browser.