mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-31 14:25:15 +00:00
Properly check against errors against fwrite
fwrite is not the same as write; you have to explicitly compare against the length to detect errors, and sometimes number of items is mistaken for length.
This commit is contained in:
@@ -51,7 +51,7 @@ fwriteall(const char *file_path, const char *string)
|
||||
goto cleanup;
|
||||
|
||||
size_t size = strlen(string);
|
||||
if (fwrite(string, 1, size, file) < size) {
|
||||
if (fwrite(string, 1, size, file) != size) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user