Don't try to fflush(export_fp) or ferror(export_fp) if export_fp
is NULL, which can happen on the error path.
This commit is contained in:
@@ -1062,10 +1062,12 @@ export_sudoers(const char *sudoers_path, const char *export_path,
|
|||||||
fputs("\n}\n", export_fp);
|
fputs("\n}\n", export_fp);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
(void)fflush(export_fp);
|
if (export_fp != NULL) {
|
||||||
if (ferror(export_fp))
|
(void)fflush(export_fp);
|
||||||
rval = false;
|
if (ferror(export_fp))
|
||||||
if (export_fp != stdout && export_fp != NULL)
|
rval = false;
|
||||||
fclose(export_fp);
|
if (export_fp != stdout)
|
||||||
|
fclose(export_fp);
|
||||||
|
}
|
||||||
debug_return_bool(rval);
|
debug_return_bool(rval);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user