sysctl: simplify file close error checking
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
52269d22f3
commit
bf47d16095
10
sysctl.c
10
sysctl.c
@ -443,14 +443,10 @@ static int WriteSetting(const char *setting)
|
||||
}
|
||||
} else {
|
||||
rc = fprintf(fp, "%s\n", value);
|
||||
if (rc < 0) {
|
||||
if (0 < rc)
|
||||
rc = 0;
|
||||
if (close_stream(fp) != 0)
|
||||
xwarn(_("setting key \"%s\""), outname);
|
||||
fclose(fp);
|
||||
} else {
|
||||
rc = fclose(fp);
|
||||
if (rc != 0)
|
||||
xwarn(_("setting key \"%s\""), outname);
|
||||
}
|
||||
if (rc == 0 && !Quiet) {
|
||||
if (NameOnly) {
|
||||
fprintf(stdout, "%s\n", outname);
|
||||
|
Loading…
Reference in New Issue
Block a user