summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/havege.c1
-rw-r--r--src/havege.h3
-rw-r--r--src/havegecmd.c1
-rw-r--r--src/havegecmd.h1
-rw-r--r--src/havegecollect.c1
-rw-r--r--src/havegecollect.h1
-rw-r--r--src/haveged.c49
-rw-r--r--src/haveged.h1
-rw-r--r--src/havegetest.c1
-rw-r--r--src/havegetest.h1
-rw-r--r--src/havegetune.c1
-rw-r--r--src/havegetune.h1
-rw-r--r--src/oneiteration.h1
13 files changed, 45 insertions, 18 deletions
diff --git a/src/havege.c b/src/havege.c
index 6710458..a75f5e7 100644
--- a/src/havege.c
+++ b/src/havege.c
@@ -1,6 +1,7 @@
/**
** Simple entropy harvester based upon the havege RNG
**
+ ** Copyright 2018-2020 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2009-2014 Gary Wuertz gary@issiweb.com
** Copyright 2011-2012 BenEleventh Consulting manolson@beneleventh.com
**
diff --git a/src/havege.h b/src/havege.h
index 35bda94..46eccf2 100644
--- a/src/havege.h
+++ b/src/havege.h
@@ -1,6 +1,7 @@
/**
** Simple entropy harvester based upon the havege RNG
**
+ ** Copyright 2018-2020 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2009-2014 Gary Wuertz gary@issiweb.com
** Copyright 2011-2012 BenEleventh Consulting manolson@beneleventh.com
**
@@ -30,7 +31,7 @@ extern "C" {
* header/package version as a numeric major, minor, patch triple. See havege_version()
* below for useage.
*/
-#define HAVEGE_PREP_VERSION "1.9.8"
+#define HAVEGE_PREP_VERSION "1.9.9"
/**
* Basic types
*/
diff --git a/src/havegecmd.c b/src/havegecmd.c
index d38a101..b691c29 100644
--- a/src/havegecmd.c
+++ b/src/havegecmd.c
@@ -1,6 +1,7 @@
/**
** Provide HAVEGE socket communication API
**
+ ** Copyright 2018-2020 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2018 Werner Fink <werner@suse.de>
**
** This program is free software: you can redistribute it and/or modify
diff --git a/src/havegecmd.h b/src/havegecmd.h
index e928265..997c5d1 100644
--- a/src/havegecmd.h
+++ b/src/havegecmd.h
@@ -1,6 +1,7 @@
/**
** Provide HAVEGE socket communication API
**
+ ** Copyright 2018-2020 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2018 Werner Fink <werner@suse.de>
**
** This program is free software: you can redistribute it and/or modify
diff --git a/src/havegecollect.c b/src/havegecollect.c
index eb57447..02831b8 100644
--- a/src/havegecollect.c
+++ b/src/havegecollect.c
@@ -1,6 +1,7 @@
/**
** Simple entropy harvester based upon the havege RNG
**
+ ** Copyright 2018-2020 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2009-2014 Gary Wuertz gary@issiweb.com
** Copyright 2011-2012 BenEleventh Consulting manolson@beneleventh.com
**
diff --git a/src/havegecollect.h b/src/havegecollect.h
index 6259862..822e122 100644
--- a/src/havegecollect.h
+++ b/src/havegecollect.h
@@ -1,6 +1,7 @@
/**
** Simple entropy harvester based upon the havege RNG
**
+ ** Copyright 2018-2020 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2009-2014 Gary Wuertz gary@issiweb.com
** Copyright 2011-2012 BenEleventh Consulting manolson@beneleventh.com
**
diff --git a/src/haveged.c b/src/haveged.c
index 4d05fdb..53f71df 100644
--- a/src/haveged.c
+++ b/src/haveged.c
@@ -1,6 +1,7 @@
/**
** Simple entropy harvester based upon the havege RNG
**
+ ** Copyright 2018-2020 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2009-2014 Gary Wuertz gary@issiweb.com
** Copyright 2011-2012 BenEleventh Consulting manolson@beneleventh.com
**
@@ -384,12 +385,17 @@ int main(int argc, char **argv)
else {
socket_fd = cmd_listen(params);
if (socket_fd >= 0)
- fprintf(stderr, "%s: listening socket at %d\n", params->daemon, socket_fd);
- else if (socket_fd == -2)
- fprintf(stderr, "%s: command socket already in use\n", params->daemon);
- else
- fprintf(stderr, "%s: can not initialize command socket: %m\n", params->daemon);
+ fprintf(stderr, "%s: command socket is listening at fd %d\n", params->daemon, socket_fd);
+ else {
+ if (socket_fd == -2) {
+ fprintf(stderr, "%s: command socket already in use\n", params->daemon);
+ fprintf(stderr, "%s: please check if there is another instance of haveged running\n", params->daemon);
+ fprintf(stderr, "%s: disabling command mode for this instance\n", params->daemon);
+ } else {
+ fprintf(stderr, "%s: can not initialize command socket: %m\n", params->daemon);
+ }
}
+ }
#endif
if (params->tests_config == 0)
params->tests_config = (0 != (params->setup & RUN_AS_APP))? TESTS_DEFAULT_APP : TESTS_DEFAULT_RUN;
@@ -576,27 +582,36 @@ static void run_daemon( /* RETURN: nothing */
FD_ZERO(&write_fd);
#ifndef NO_COMMAND_MODE
- FD_ZERO(&read_fd);
+ if (socket_fd >= 0) {
+ FD_ZERO(&read_fd);
+ }
#endif
FD_SET(random_fd, &write_fd);
if (random_fd > max)
max = random_fd;
#ifndef NO_COMMAND_MODE
- FD_SET(socket_fd, &read_fd);
- if (socket_fd > max)
- max = socket_fd;
- if (conn_fd >= 0) {
- FD_SET(conn_fd, &read_fd);
- if (conn_fd > max)
- max = conn_fd;
- }
+ if (socket_fd >= 0) {
+ FD_SET(socket_fd, &read_fd);
+ if (socket_fd > max)
+ max = socket_fd;
+ if (conn_fd >= 0) {
+ FD_SET(conn_fd, &read_fd);
+ if (conn_fd > max)
+ max = conn_fd;
+ }
+ }
#endif
for(;;) {
struct timespec two = {2, 0};
+ int rc;
#ifndef NO_COMMAND_MODE
- int rc = pselect(max+1, &read_fd, &write_fd, NULL, &two, &omask);
+ if (socket_fd >= 0) {
+ rc = pselect(max+1, &read_fd, &write_fd, NULL, &two, &omask);
+ } else {
+ rc = pselect(max+1, NULL, &write_fd, NULL, &two, &omask);
+ }
#else
- int rc = pselect(max+1, NULL, &write_fd, NULL, &two, &omask);
+ rc = pselect(max+1, NULL, &write_fd, NULL, &two, &omask);
#endif
if (rc >= 0) break;
if (params->exit_code > 128)
@@ -608,7 +623,7 @@ static void run_daemon( /* RETURN: nothing */
continue;
#ifndef NO_COMMAND_MODE
- if (FD_ISSET(socket_fd, &read_fd) && conn_fd < 0) {
+ if ( socket_fd >= 0 && FD_ISSET(socket_fd, &read_fd) && conn_fd < 0) {
# ifdef HAVE_ACCEPT4
conn_fd = accept4(socket_fd, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK);
if (conn_fd < 0 && (errno == ENOSYS || errno == ENOTSUP)) {
diff --git a/src/haveged.h b/src/haveged.h
index 10cb3ad..9b1efaf 100644
--- a/src/haveged.h
+++ b/src/haveged.h
@@ -1,6 +1,7 @@
/**
** Simple entropy harvester based upon the havege RNG
**
+ ** Copyright 2018-2020 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2009-2014 Gary Wuertz gary@issiweb.com
**
** This program is free software: you can redistribute it and/or modify
diff --git a/src/havegetest.c b/src/havegetest.c
index 8cbb89a..8b423fb 100644
--- a/src/havegetest.c
+++ b/src/havegetest.c
@@ -1,6 +1,7 @@
/**
** Simple entropy harvester based upon the havege RNG
**
+ ** Copyright 2018-2020 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2012-2014 Gary Wuertz gary@issiweb.com
** Copyright 2012 BenEleventh Consulting manolson@beneleventh.com
**
diff --git a/src/havegetest.h b/src/havegetest.h
index cd9de4b..a58d9c0 100644
--- a/src/havegetest.h
+++ b/src/havegetest.h
@@ -1,6 +1,7 @@
/**
** Simple entropy harvester based upon the havege RNG
**
+ ** Copyright 2018-2020 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2012-2014 Gary Wuertz gary@issiweb.com
** Copyright 2012 BenEleventh Consulting manolson@beneleventh.com
**
diff --git a/src/havegetune.c b/src/havegetune.c
index 6f14476..19d3965 100644
--- a/src/havegetune.c
+++ b/src/havegetune.c
@@ -1,6 +1,7 @@
/**
** Determine HAVEGE environment
**
+ ** Copyright 2018-2020 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2009-2014 Gary Wuertz gary@issiweb.com
** Copyright 2011-2012 BenEleventh Consulting manolson@beneleventh.com
**
diff --git a/src/havegetune.h b/src/havegetune.h
index b4063e3..68e7232 100644
--- a/src/havegetune.h
+++ b/src/havegetune.h
@@ -1,6 +1,7 @@
/**
** Simple entropy harvester based upon the havege RNG
**
+ ** Copyright 2018-2020 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2009-2014 Gary Wuertz gary@issiweb.com
**
** This program is free software: you can redistribute it and/or modify
diff --git a/src/oneiteration.h b/src/oneiteration.h
index 0ffc246..298c3f4 100644
--- a/src/oneiteration.h
+++ b/src/oneiteration.h
@@ -1,6 +1,7 @@
/**
** Simple entropy harvester based upon the havege RNG
**
+ ** Copyright 2018-2020 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2009-2013 Gary Wuertz gary@issiweb.com
**
** This program is free software: you can redistribute it and/or modify