diff options
author | Joey Hess <joey@kitenet.net> | 2013-04-02 01:34:50 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-04-02 01:34:50 -0400 |
commit | 6684c636fd26eab49eec25d0538b2fc4b5542924 (patch) | |
tree | e5e6f43c062f4c0306d8776c14d5ceb811470187 | |
parent | 132b2771bbf29083ab51d8735de672cb530bc7af (diff) | |
download | moreutils-6684c636fd26eab49eec25d0538b2fc4b5542924.tar.gz |
sponge: Check fclose to detect certian short reads. Closes: #704453
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | sponge.c | 10 |
2 files changed, 9 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog index 23a6beb..047e87d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,7 @@ moreutils (0.48) UNRELEASED; urgency=low Thanks, Thomas Vander Stichele * ts: Support single-digit day dates. Thanks, Peter Lunicks + * sponge: Check fclose to detect certian short reads. Closes: #704453 -- Joey Hess <joeyh@debian.org> Wed, 25 Jul 2012 23:39:34 -0400 @@ -222,8 +222,14 @@ static void copy_tmpfile (FILE *tmpfile, FILE *outfile, char *buf, size_t size) fclose(tmpfile); exit(1); } - fclose(tmpfile); - fclose(outfile); + if (fclose(tmpfile) != 0) { + perror("read temporary file"); + exit(1); + } + if (fclose(outfile) != 0) { + perror("error writing buffer to output file"); + exit(1); + } } FILE *open_tmpfile (void) { |