mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
libutil: fix util_file_write_* return code
By default, files opened via fopen are block-buffered. As a result, I/O errors that occur during file write operations via util_file_write_* are silently ignored because fputs() only buffers data while actual I/O occurs during the flush operation that is part of the final fclose() library call. Fix this by indicating errors that occur during fclose() via the util_file_write_* function return code. Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
committed by
Steffen Eiden
parent
fb0b6263d1
commit
a97a8f1cba
@@ -110,7 +110,8 @@ static int file_puts(const char *str, const char *path)
|
||||
}
|
||||
rc = 0;
|
||||
out_fclose:
|
||||
fclose(fp);
|
||||
if (fclose(fp))
|
||||
return -1;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user