From: Petr Štetiar Date: Mon, 27 May 2019 13:06:31 +0000 (+0200) Subject: Init logging before actually using it X-Git-Tag: v1.0.1~5 X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=41e4163b2e7f4c1c1f51cdfa487d6052ff859cf2;p=project%2Furngd.git Init logging before actually using it Otherwise we don't get urngd: prefixed log messages which might be confusing: procd: - watchdog - jent-rng init failed, err: 2 procd: - watchdog - While at it add missing newline in one error message. Signed-off-by: Petr Štetiar --- diff --git a/urngd.c b/urngd.c index 8b9a762..f57a162 100644 --- a/urngd.c +++ b/urngd.c @@ -176,7 +176,7 @@ static bool urngd_init(struct urngd *u) u->rnd_fd.cb = low_entropy_cb; u->rnd_fd.fd = open(DEV_RANDOM, O_WRONLY); if (u->rnd_fd.fd < 1) { - ERROR(DEV_RANDOM " open failed: %s", strerror(errno)); + ERROR(DEV_RANDOM " open failed: %s\n", strerror(errno)); return false; } @@ -225,10 +225,11 @@ int main(int argc, char **argv) } } + ulog_open(ulog_channels, LOG_DAEMON, "urngd"); + if (!urngd_init(&urngd_service)) return -1; - ulog_open(ulog_channels, LOG_DAEMON, "urngd"); LOG("v%s started.\n", URNGD_VERSION); gather_entropy(&urngd_service);