# --- ROCK-COPYRIGHT-NOTE-BEGIN --- # # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # Please add additional copyright information _after_ the line containing # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by # the ./scripts/Create-CopyPatch script. Do not edit this copyright text! # # ROCK Linux: rock-src/package/base/gawk/no_such_file_fix.patch # ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # # --- ROCK-COPYRIGHT-NOTE-END --- http://lists.gnu.org/archive/html/bug-gnu-utils/2005-08/msg00047.html --- ./io.c 2005-07-26 21:07:43.000000000 +0300 +++ ./io.c 2005-08-12 13:10:28.239852344 +0300 @@ -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)) @@ -2503,7 +2507,7 @@ iop->readsize = iop->size = optimal_bufsize(iop->fd, & sbuf); iop->sbuf = sbuf; if (do_lint && S_ISREG(sbuf.st_mode) && sbuf.st_size == 0) - lintwarn(_("data file `%s' is empty"), name); + lintwarn(_("data file `%s' is empty"), name); errno = 0; iop->count = iop->scanoff = 0; emalloc(iop->buf, char *, iop->size += 2, "iop_alloc");