diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-01-20 19:19:53 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-01-20 19:19:53 +0100 |
commit | 16354eff99fe673f912862138c4dce30bbd0afb5 (patch) | |
tree | f08b5fd25de0e3b34e3ea50062028af9e953e8c1 /main.c | |
parent | 5899f3b7f62151dade30010370fb5d2bcdb93d3a (diff) |
make use of logging API wherever appropriate
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -3,8 +3,10 @@ #include <stdio.h> #include <errno.h> #include <string.h> +#include <unistd.h> #include "manager.h" +#include "log.h" int main(int argc, char *argv[]) { Manager *m = NULL; @@ -12,24 +14,25 @@ int main(int argc, char *argv[]) { Job *job = NULL; int r, retval = 1; + assert_se(chdir("test1") == 0); + if (!(m = manager_new()) < 0) { - fprintf(stderr, "Failed to allocate manager object: %s\n", strerror(ENOMEM)); + log_error("Failed to allocate manager object: %s", strerror(ENOMEM)); goto finish; } - if ((r = manager_load_name(m, "default.milestone", &milestone)) < 0) { - fprintf(stderr, "Failed to load default milestone: %s\n", strerror(-r)); + log_error("Failed to load default milestone: %s", strerror(-r)); goto finish; } if ((r = manager_load_name(m, "syslog.socket", &syslog)) < 0) { - fprintf(stderr, "Failed to load syslog socket: %s\n", strerror(-r)); + log_error("Failed to load syslog socket: %s", strerror(-r)); goto finish; } if ((r = manager_add_job(m, JOB_START, milestone, JOB_REPLACE, false, &job)) < 0) { - fprintf(stderr, "Failed to start default milestone: %s\n", strerror(-r)); + log_error("Failed to start default milestone: %s", strerror(-r)); goto finish; } @@ -40,7 +43,7 @@ int main(int argc, char *argv[]) { manager_dump_jobs(m, stdout, "\t"); if ((r = manager_add_job(m, JOB_STOP, syslog, JOB_REPLACE, false, &job)) < 0) { - fprintf(stderr, "Failed to start default milestone: %s\n", strerror(-r)); + log_error("Failed to start default milestone: %s", strerror(-r)); goto finish; } |