Deactivate _FORTIFY_SOURCE in jitterentropy-base.c
[project/urngd.git] / urngd.c
diff --git a/urngd.c b/urngd.c
index 306420a397dcc67db67cb44709bd4926a46d8a45..35ccdec49af2c2fa2958cf7bd9d8f1cbeb43cb50 100644 (file)
--- a/urngd.c
+++ b/urngd.c
@@ -91,7 +91,7 @@ static size_t write_entropy(struct urngd *u, char *buf, size_t len,
        if (0 > ret) {
                ERROR("error injecting entropy: %s\n", strerror(errno));
        } else {
-               DEBUG(1, "injected %ub (%ub of entropy)\n", len, entropy_bytes);
+               DEBUG(1, "injected %zub (%zub of entropy)\n", len, entropy_bytes);
                written = len;
        }
 
@@ -121,7 +121,7 @@ static size_t gather_entropy(struct urngd *u)
        }
 
        memset_secure(buf, 0, sizeof(buf));
-       DEBUG(2, DEV_RANDOM " fed with %lub of entropy\n", ret);
+       DEBUG(2, DEV_RANDOM " fed with %zub of entropy\n", ret);
 
        return ret;
 }
@@ -180,7 +180,7 @@ static bool urngd_init(struct urngd *u)
                return false;
        }
 
-       uloop_fd_add(&u->rnd_fd, ULOOP_READ);
+       uloop_fd_add(&u->rnd_fd, ULOOP_WRITE);
 
        return true;
 }
@@ -227,14 +227,16 @@ int main(int argc, char **argv)
 
        ulog_open(ulog_channels, LOG_DAEMON, "urngd");
 
-       if (!urngd_init(&urngd_service))
+       uloop_init();
+       if (!urngd_init(&urngd_service)) {
+               uloop_done();
                return -1;
+       }
 
        LOG("v%s started.\n", URNGD_VERSION);
 
        gather_entropy(&urngd_service);
 
-       uloop_init();
        uloop_run();
        uloop_done();