diff options
author | Bruno Haible <bruno@clisp.org> | 2018-04-07 12:21:04 +0200 |
---|---|---|
committer | Andreas Gruenbacher <agruen@gnu.org> | 2018-04-07 16:41:14 +0200 |
commit | 1e9104c18019e7dc6b5590aea4b1d4f9d8ecfd56 (patch) | |
tree | 94a820acd8af89ccf8e83cb557b08cd539eaed4c /src/patch.c | |
parent | ae81be0024ea4eaf139b7ba57e9a8ce9e4a163ec (diff) | |
download | patch-1e9104c18019e7dc6b5590aea4b1d4f9d8ecfd56.tar.gz |
Fix check of return value of fwrite().
* src/patch.c (copy_till): Consider incomplete fwrite() write as an error.
* src/pch.c (pch_write_line, do_ed_script): Likewise.
Diffstat (limited to 'src/patch.c')
-rw-r--r-- | src/patch.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/patch.c b/src/patch.c index 1ae91d9..3fcaec5 100644 --- a/src/patch.c +++ b/src/patch.c @@ -2,7 +2,7 @@ /* Copyright (C) 1984, 1985, 1986, 1987, 1988 Larry Wall - Copyright (C) 1989-1993, 1997-1999, 2002-2003, 2006, 2009-2012 Free Software + Copyright (C) 1989-1993, 1997-1999, 2002-2003, 2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -1641,7 +1641,7 @@ copy_till (struct outstate *outstate, lin lastline) if (size) { if ((! outstate->after_newline && putc ('\n', fp) == EOF) - || ! fwrite (s, sizeof *s, size, fp)) + || fwrite (s, sizeof *s, size, fp) < size) write_fatal (); outstate->after_newline = s[size - 1] == '\n'; outstate->zero_output = false; |