Browse Source

* use log_fatal

master
Alex 'AdUser' Z 8 years ago
parent
commit
d29a8566a9
  1. 6
      src/backend-test.c
  2. 4
      src/daemon.c
  3. 8
      src/source-test.c

6
src/backend-test.c

@ -25,19 +25,19 @@ int main(int argc, char *argv[]) {
memset(&config, 0x0, sizeof(config));
if (f2b_config_load(&config, argv[1], false) != true) {
f2b_log_msg(log_error, "can't load config");
f2b_log_msg(log_fatal, "can't load config");
return EXIT_FAILURE;
}
if (config.backends == NULL) {
f2b_log_msg(log_error, "no backends found in config");
f2b_log_msg(log_fatal, "no backends found in config");
return EXIT_FAILURE;
} else {
section = config.backends;
}
if ((backend = f2b_backend_create(section, argv[2])) == NULL) {
f2b_log_msg(log_error, "can't create backend '%s' with id '%s'", section->name, argv[2]);
f2b_log_msg(log_fatal, "can't create backend '%s' with id '%s'", section->name, argv[2]);
return EXIT_FAILURE;
}

4
src/daemon.c

@ -322,7 +322,7 @@ int main(int argc, char *argv[]) {
const char *err = (errno == EWOULDBLOCK)
? "another instance already running"
: strerror(errno);
f2b_log_msg(log_error, "can't lock pidfile: %s", err);
f2b_log_msg(log_fatal, "can't lock pidfile: %s", err);
exit(EXIT_FAILURE);
}
fprintf(pidfile, "%d\n", getpid());
@ -342,7 +342,7 @@ int main(int argc, char *argv[]) {
f2b_config_free(&config);
if (!jails) {
f2b_log_msg(log_warn, "no jails configured, exiting");
f2b_log_msg(log_fatal, "no jails configured, exiting");
return EXIT_FAILURE;
}

8
src/source-test.c

@ -26,24 +26,24 @@ int main(int argc, char *argv[]) {
memset(&config, 0x0, sizeof(config));
if (f2b_config_load(&config, argv[1], false) != true) {
f2b_log_msg(log_error, "can't load config");
f2b_log_msg(log_fatal, "can't load config");
return EXIT_FAILURE;
}
if (config.sources == NULL) {
f2b_log_msg(log_error, "no sources found in config");
f2b_log_msg(log_fatal, "no sources found in config");
return EXIT_FAILURE;
} else {
section = config.sources;
}
if ((source = f2b_source_create(section, argv[2], f2b_log_error_cb)) == NULL) {
f2b_log_msg(log_error, "can't create source '%s' with init '%s'", section->name, argv[2]);
f2b_log_msg(log_fatal, "can't create source '%s' with init '%s'", section->name, argv[2]);
return EXIT_FAILURE;
}
if (f2b_source_start(source) == false) {
f2b_log_msg(log_error, "source start error: %s", f2b_source_error(source));
f2b_log_msg(log_fatal, "source start error: %s", f2b_source_error(source));
exit(EXIT_FAILURE);
}

Loading…
Cancel
Save