mirror of
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git
synced 2024-11-14 13:33:50 +08:00
lib: utils: close file handle on error
reap_prop() doesn't close the file descriptor on some errors, fix it. Signed-off-by: Denis Kirjanov <kirjanov@gmail.com>
This commit is contained in:
parent
d092468f11
commit
c009c955fd
@ -70,7 +70,6 @@ int read_prop(const char *dev, char *prop, long *value)
|
||||
|
||||
if (!fgets(buf, sizeof(buf), fp)) {
|
||||
fprintf(stderr, "property \"%s\" in file %s is currently unknown\n", prop, fname);
|
||||
fclose(fp);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -95,6 +94,7 @@ int read_prop(const char *dev, char *prop, long *value)
|
||||
*value = result;
|
||||
return 0;
|
||||
out:
|
||||
fclose(fp);
|
||||
fprintf(stderr, "Failed to parse %s\n", fname);
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user