Loading package/gawk/gawk-3.1.5-core.patch 0 → 100644 +31 −0 Original line number Diff line number Diff line fix an ugly core on a simple script http://lists.gnu.org/archive/html/bug-gnu-utils/2005-08/msg00040.html http://lists.gnu.org/archive/html/bug-gnu-utils/2005-08/msg00047.html --- gawk/io.c +++ gawk/io.c @@ -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)) package/gawk/gawk-3.1.5-gcc4.patch 0 → 100644 +23 −0 Original line number Diff line number Diff line Sat Sep 3 16:03:25 EDT 2005 Kito Danya Dietrich <kito@gentoo.org> * hard-locale.h (hard_locale): Declare xmalloc in global scope rather than function scope which gcc-4.x rejects. --- gawk-3.1.5/hard-locale.h +++ gawk-3.1.5/hard-locale.h @@ -21,6 +21,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +static ptr_t xmalloc PARAMS ((size_t n)); /* Return nonzero if the current CATEGORY locale is hard, i.e. if you can't get away with assuming traditional C or POSIX behavior. */ @@ -40,7 +41,6 @@ if (strcmp (p, "C") == 0 || strcmp (p, "POSIX") == 0) hard = 0; # else - static ptr_t xmalloc PARAMS ((size_t n)); char *locale = xmalloc (strlen (p) + 1); strcpy (locale, p); package/gawk/gawk.mk +4 −2 Original line number Diff line number Diff line Loading @@ -3,10 +3,11 @@ # gawk # ############################################################# GAWK_SOURCE:=gawk-3.1.2.tar.gz GAWK_VER:=3.1.5 GAWK_SOURCE:=gawk-$(GAWK_VER).tar.gz GAWK_SITE:=ftp://ftp.gnu.org/gnu/gawk GAWK_CAT:=zcat GAWK_DIR:=$(BUILD_DIR)/gawk-3.1.2 GAWK_DIR:=$(BUILD_DIR)/gawk-$(GAWK_VER) GAWK_BINARY:=gawk GAWK_TARGET_BINARY:=usr/bin/gawk Loading @@ -17,6 +18,7 @@ gawk-source: $(DL_DIR)/$(GAWK_SOURCE) $(GAWK_DIR)/.unpacked: $(DL_DIR)/$(GAWK_SOURCE) $(GAWK_CAT) $(DL_DIR)/$(GAWK_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - toolchain/patch-kernel.sh $(GAWK_DIR) package/gawk gawk\*.patch touch $(GAWK_DIR)/.unpacked $(GAWK_DIR)/.configured: $(GAWK_DIR)/.unpacked Loading Loading
package/gawk/gawk-3.1.5-core.patch 0 → 100644 +31 −0 Original line number Diff line number Diff line fix an ugly core on a simple script http://lists.gnu.org/archive/html/bug-gnu-utils/2005-08/msg00040.html http://lists.gnu.org/archive/html/bug-gnu-utils/2005-08/msg00047.html --- gawk/io.c +++ gawk/io.c @@ -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))
package/gawk/gawk-3.1.5-gcc4.patch 0 → 100644 +23 −0 Original line number Diff line number Diff line Sat Sep 3 16:03:25 EDT 2005 Kito Danya Dietrich <kito@gentoo.org> * hard-locale.h (hard_locale): Declare xmalloc in global scope rather than function scope which gcc-4.x rejects. --- gawk-3.1.5/hard-locale.h +++ gawk-3.1.5/hard-locale.h @@ -21,6 +21,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +static ptr_t xmalloc PARAMS ((size_t n)); /* Return nonzero if the current CATEGORY locale is hard, i.e. if you can't get away with assuming traditional C or POSIX behavior. */ @@ -40,7 +41,6 @@ if (strcmp (p, "C") == 0 || strcmp (p, "POSIX") == 0) hard = 0; # else - static ptr_t xmalloc PARAMS ((size_t n)); char *locale = xmalloc (strlen (p) + 1); strcpy (locale, p);
package/gawk/gawk.mk +4 −2 Original line number Diff line number Diff line Loading @@ -3,10 +3,11 @@ # gawk # ############################################################# GAWK_SOURCE:=gawk-3.1.2.tar.gz GAWK_VER:=3.1.5 GAWK_SOURCE:=gawk-$(GAWK_VER).tar.gz GAWK_SITE:=ftp://ftp.gnu.org/gnu/gawk GAWK_CAT:=zcat GAWK_DIR:=$(BUILD_DIR)/gawk-3.1.2 GAWK_DIR:=$(BUILD_DIR)/gawk-$(GAWK_VER) GAWK_BINARY:=gawk GAWK_TARGET_BINARY:=usr/bin/gawk Loading @@ -17,6 +18,7 @@ gawk-source: $(DL_DIR)/$(GAWK_SOURCE) $(GAWK_DIR)/.unpacked: $(DL_DIR)/$(GAWK_SOURCE) $(GAWK_CAT) $(DL_DIR)/$(GAWK_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - toolchain/patch-kernel.sh $(GAWK_DIR) package/gawk gawk\*.patch touch $(GAWK_DIR)/.unpacked $(GAWK_DIR)/.configured: $(GAWK_DIR)/.unpacked Loading