clfs-1.2
clfs-2.1
clfs-3.0.0-systemd
clfs-3.0.0-sysvinit
systemd
sysvinit
Last change
on this file since 2deb938 was 69cde8d, checked in by Jim Gifford <clfs@…>, 19 years ago |
Added: All patches needed for the book.
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[69cde8d] | 1 | Submitted By: Matthew Burgess <matthew@linuxfromscratch.org>
|
---|
| 2 | Date: 2005-09-24
|
---|
| 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.
|
---|
| 7 |
|
---|
| 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 @@
|
---|
| 12 | {
|
---|
| 13 | struct stat sbuf;
|
---|
| 14 | struct open_hook *oh;
|
---|
| 15 | + int iop_malloced = FALSE;
|
---|
| 16 |
|
---|
| 17 | - if (iop == NULL)
|
---|
| 18 | + if (iop == NULL) {
|
---|
| 19 | emalloc(iop, IOBUF *, sizeof(IOBUF), "iop_alloc");
|
---|
| 20 | + iop_malloced = TRUE;
|
---|
| 21 | + }
|
---|
| 22 | memset(iop, '\0', sizeof(IOBUF));
|
---|
| 23 | iop->flag = 0;
|
---|
| 24 | iop->fd = fd;
|
---|
| 25 | @@ -2495,7 +2498,8 @@
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | if (iop->fd == INVALID_HANDLE) {
|
---|
| 29 | - free(iop);
|
---|
| 30 | + if (iop_malloced)
|
---|
| 31 | + free(iop);
|
---|
| 32 | return NULL;
|
---|
| 33 | }
|
---|
| 34 | if (isatty(iop->fd))
|
---|
| 35 | @@ -2503,7 +2507,7 @@
|
---|
| 36 | iop->readsize = iop->size = optimal_bufsize(iop->fd, & sbuf);
|
---|
| 37 | iop->sbuf = 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);
|
---|
| 41 | errno = 0;
|
---|
| 42 | iop->count = iop->scanoff = 0;
|
---|
| 43 | emalloc(iop->buf, char *, iop->size += 2, "iop_alloc");
|
---|
Note:
See
TracBrowser
for help on using the repository browser.