char * const *av;
FILE *fp;
int fd;
+ bool rval;
debug_decl(write_info_log, SUDOERS_DEBUG_UTIL)
pathbuf[len] = '\0';
fputs(*av, fp);
}
fputc('\n', fp);
- debug_return_bool(fclose(fp) == 0);
+ fflush(fp);
+
+ rval = !ferror(fp);
+ fclose(fp);
+ debug_return_bool(rval);
}
static int
export_sudoers(const char *sudoers_path, const char *export_path,
bool quiet, bool strict)
{
- bool ok = false, need_comma = false;
+ bool rval = false, need_comma = false;
const int indent = 4;
FILE *export_fp = stdout;
debug_decl(export_sudoers, SUDOERS_DEBUG_UTIL)
parse_error = true;
errorfile = sudoers_path;
}
- ok = !parse_error;
+ rval = !parse_error;
if (parse_error) {
if (!quiet) {
fputs("\n}\n", export_fp);
done:
+ (void)fflush(export_fp);
+ if (ferror(export_fp))
+ rval = false;
if (export_fp != stdout && export_fp != NULL)
fclose(export_fp);
- debug_return_bool(ok);
+ debug_return_bool(rval);
}