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 /sponge.c | |
parent | 132b2771bbf29083ab51d8735de672cb530bc7af (diff) | |
download | moreutils-6684c636fd26eab49eec25d0538b2fc4b5542924.tar.gz |
sponge: Check fclose to detect certian short reads. Closes: #704453
Diffstat (limited to 'sponge.c')
-rw-r--r-- | sponge.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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) { |