From d936068864db8e830578a6f118bb798185f7ec8a Mon Sep 17 00:00:00 2001 From: rlar Date: Sun, 12 Sep 2010 17:29:43 +0000 Subject: [PATCH] fix incorrect buffer type, and exit(1) on failure to open a tempfile --- ChangeLog | 4 ++++ src/main.c | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2a785554d..d83115fd0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-09-12 Robert Larice + * src/main.c : + fix incorrect buffer type, and exit(1) on failure to open a tempfile + 2010-09-08 Holger Vogt * inp.c, inpcom.c: include libiberty.h removed * terminal.c, ivars.c, ifnewuid.c, inperror.c, tclspice.c, main.c: diff --git a/src/main.c b/src/main.c index 9b2d3a700..a12f965cc 100644 --- a/src/main.c +++ b/src/main.c @@ -629,7 +629,7 @@ show_version(void) static void append_to_stream(FILE *dest, FILE *source) { - char *buf[BSIZE_SP]; + char buf[BSIZE_SP]; int i; while ((i = fread(buf, 1, BSIZE_SP, source)) > 0) @@ -1084,6 +1084,11 @@ bot: } #endif + if(!tempfile) { + perror("tmpfile()"); + exit(1); + } + if (optind == argc && !istty) { append_to_stream(tempfile, stdin); }