From c5a183de108e5685305734d5cf984b58bb0d614a Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 29 Oct 2007 10:34:43 -0400 Subject: grap: fclose, error context bug fixes (Doug Gwyn) --- src/cmd/grap/input.c | 2 +- src/cmd/grap/print.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cmd/grap/input.c b/src/cmd/grap/input.c index d47cbd75..99465d37 100644 --- a/src/cmd/grap/input.c +++ b/src/cmd/grap/input.c @@ -460,7 +460,7 @@ void eprint(void) /* try to print context around error */ if (isprint((uchar)*p)) putc(*p, stderr); fprintf(stderr, " >>> "); - for (; p < q; p++) + for (; p < ep; p++) if (isprint((uchar)*p)) putc(*p, stderr); fprintf(stderr, " <<< "); diff --git a/src/cmd/grap/print.c b/src/cmd/grap/print.c index dbecb5df..a7497e44 100644 --- a/src/cmd/grap/print.c +++ b/src/cmd/grap/print.c @@ -23,8 +23,9 @@ void print(void) /* arrange final output */ int c; double dx, dy, xfac, yfac; - if (tfd != NULL) { - fclose(tfd); /* end the temp file */ + if (tfd != stdout) { + if (tfd) + fclose(tfd); /* end the temp file */ tfd = stdout; } -- cgit v1.2.3