signal(SIGSEGV, SIG_DFL);
int r;
if ((r = unw_init_local(&cursor, (unw_context_t *)(context)) != 0)) {
- fprintf(stderr, "unable to obtain stack trace: unw_init_local: %s\n", unw_strerror(r));
+ SCLogError("unable to obtain stack trace: unw_init_local: %s", unw_strerror(r));
goto terminate;
}
bpf_filter[strlen(bpf_filter)-1] = '\0';
}
if (strlen(bpf_filter) > 0) {
- if(ConfSetFinal("bpf-filter", bpf_filter) != 1) {
- SCLogError("ERROR: Failed to set bpf filter!");
+ if (ConfSetFinal("bpf-filter", bpf_filter) != 1) {
SCFree(bpf_filter);
- exit(EXIT_FAILURE);
+ FatalError("failed to set bpf filter");
}
}
}
EngineModeSetIPS();
} else if (strcmp((long_opts[option_index]).name, "init-errors-fatal") == 0) {
if (ConfSetFinal("engine.init-failure-fatal", "1") != 1) {
- fprintf(stderr, "ERROR: Failed to set engine init-failure-fatal.\n");
+ SCLogError("failed to set engine init-failure-fatal");
return TM_ECODE_FAILED;
}
#ifdef BUILD_UNIX_SOCKET
suri->run_mode = RUNMODE_UNIX_SOCKET;
if (optarg) {
if (ConfSetFinal("unix-command.filename", optarg) != 1) {
- fprintf(stderr, "ERROR: Failed to set unix-command.filename.\n");
+ SCLogError("failed to set unix-command.filename");
return TM_ECODE_FAILED;
}
#ifdef UNITTESTS
suri->run_mode = RUNMODE_LIST_UNITTEST;
#else
- fprintf(stderr, "ERROR: Unit tests not enabled. Make sure to pass --enable-unittests to configure when building.\n");
+ SCLogError("unit tests not enabled. Make sure to pass --enable-unittests to "
+ "configure when building");
return TM_ECODE_FAILED;
#endif /* UNITTESTS */
} else if (strcmp((long_opts[option_index]).name, "list-runmodes") == 0) {
#ifdef UNITTESTS
unittests_fatal = 1;
#else
- fprintf(stderr, "ERROR: Unit tests not enabled. Make sure to pass --enable-unittests to configure when building.\n");
+ SCLogError("unit tests not enabled. Make sure to pass --enable-unittests to "
+ "configure when building");
return TM_ECODE_FAILED;
#endif /* UNITTESTS */
} else if (strcmp((long_opts[option_index]).name, "user") == 0) {
} else if (strcmp((long_opts[option_index]).name, "erf-in") == 0) {
suri->run_mode = RUNMODE_ERF_FILE;
if (ConfSetFinal("erf-file.file", optarg) != 1) {
- fprintf(stderr, "ERROR: Failed to set erf-file.file\n");
+ SCLogError("failed to set erf-file.file");
return TM_ECODE_FAILED;
}
} else if (strcmp((long_opts[option_index]).name, "dag") == 0) {
FatalError("Invalid argument for --set, must be key=val.");
}
if (!ConfSetFromString(optarg, 1)) {
- fprintf(stderr, "Failed to set configuration value %s.",
- optarg);
- exit(EXIT_FAILURE);
+ FatalError("failed to set configuration value %s", optarg);
}
}
}
case 'T':
conf_test = 1;
if (ConfSetFinal("engine.init-failure-fatal", "1") != 1) {
- fprintf(stderr, "ERROR: Failed to set engine init-failure-fatal.\n");
+ SCLogError("failed to set engine init-failure-fatal");
return TM_ECODE_FAILED;
}
break;
return TM_ECODE_FAILED;
}
#else
- fprintf(stderr, "ERROR: Unit tests not enabled. Make sure to pass --enable-unittests to configure when building.\n");
+ SCLogError("unit tests not enabled. Make sure to pass --enable-unittests to configure "
+ "when building.");
return TM_ECODE_FAILED;
#endif /* UNITTESTS */
break;