sysctl: simplify file close error checking

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2012-03-23 15:53:01 +01:00
parent 52269d22f3
commit bf47d16095

View File

@ -443,14 +443,10 @@ static int WriteSetting(const char *setting)
} }
} else { } else {
rc = fprintf(fp, "%s\n", value); rc = fprintf(fp, "%s\n", value);
if (rc < 0) { if (0 < rc)
rc = 0;
if (close_stream(fp) != 0)
xwarn(_("setting key \"%s\""), outname); xwarn(_("setting key \"%s\""), outname);
fclose(fp);
} else {
rc = fclose(fp);
if (rc != 0)
xwarn(_("setting key \"%s\""), outname);
}
if (rc == 0 && !Quiet) { if (rc == 0 && !Quiet) {
if (NameOnly) { if (NameOnly) {
fprintf(stdout, "%s\n", outname); fprintf(stdout, "%s\n", outname);