mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-09-08 06:31:50 +00:00
Simplify fgets() error handling to use one goto
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
This commit is contained in:
+2
-4
@@ -90,12 +90,10 @@ static int set_default_value(char **global, const char *path)
|
||||
if (fgets(line, LINE_MAX, file) == NULL) {
|
||||
if (ferror(file)) {
|
||||
printf("Error: Unable to read data from %s\n", rel_path);
|
||||
goto fail;
|
||||
}
|
||||
if (feof(file)) {
|
||||
} else if (feof(file)) {
|
||||
printf("Error: Contents of %s are empty\n", rel_path);
|
||||
goto fail;
|
||||
}
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* remove newline if present */
|
||||
|
||||
Reference in New Issue
Block a user