mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-28 19:06:42 -05:00
Avoid duplicate fatal stderr output in GUI mode
This commit is contained in:
parent
d0194c3aff
commit
ecb12ee92c
6 changed files with 51 additions and 18 deletions
|
|
@ -178,16 +178,18 @@ void log_open(const char* file)
|
|||
|
||||
void log_close(const char* file)
|
||||
{
|
||||
if (stdlog != stdout && stdlog != stderr && stdlog != 0) {
|
||||
if (fclose(stdlog) != 0) {
|
||||
FILE* log = stdlog;
|
||||
|
||||
/* fclose() invalidates the stream even on error, so fatal reporting must use stderr. */
|
||||
stdlog = 0;
|
||||
if (log != stdout && log != stderr && log != 0) {
|
||||
if (fclose(log) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal(errno, "Error closing the log file '%s'. %s.\n", file, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
}
|
||||
|
||||
stdlog = 0;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
|
@ -1065,6 +1067,8 @@ int snapraid_main(int argc, char* argv[])
|
|||
}
|
||||
}
|
||||
|
||||
msg_fatal_stderr = !opt.gui;
|
||||
|
||||
os_init(OS_INIT_OPT_AVOID_SLEEP | (opt.force_scan_winfind ? OS_INIT_OPT_WINFIND : 0));
|
||||
app_init();
|
||||
raid_init();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue