chiark / gitweb /
core: switch all log targets to go directly to the journal, instead via syslog
[elogind.git] / src / random-seed.c
index 054233e66035210b9d10dcfd404004932f4efaeb..8b43bacadc67580f8657b1dc67b4ace6cf7effb1 100644 (file)
@@ -43,13 +43,19 @@ int main(int argc, char *argv[]) {
                 return EXIT_FAILURE;
         }
 
-        log_set_target(LOG_TARGET_SYSLOG_OR_KMSG);
+        log_set_target(LOG_TARGET_AUTO);
         log_parse_environment();
         log_open();
 
+        umask(0022);
+
         /* Read pool size, if possible */
         if ((f = fopen("/proc/sys/kernel/random/poolsize", "re"))) {
-                fscanf(f, "%zu", &buf_size);
+                if (fscanf(f, "%zu", &buf_size) > 0) {
+                        /* poolsize is in bits on 2.6, but we want bytes */
+                        buf_size /= 8;
+                }
+
                 fclose(f);
         }