aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2012-08-01 14:31:37 -0700
committerJeff Garzik <jgarzik@redhat.com>2012-08-02 00:18:54 -0400
commit31a7953fa9fd18d50d9b4dc0d3bad65d560be3a2 (patch)
treed03d2ab1d73e11c1106b13d2fbfd1a1bc955d576
parent932e25b20fbf46dbc6d4438bbdd92fdfd1693e7b (diff)
downloadrng-tools-31a7953fa9fd18d50d9b4dc0d3bad65d560be3a2.tar.gz
rng-tools-31a7953fa9fd18d50d9b4dc0d3bad65d560be3a2.tar.xz
rng-tools-31a7953fa9fd18d50d9b4dc0d3bad65d560be3a2.zip
rngd_linux: Log a warning if write_wakeup_threshold can't be adjusted
If we fail to write write_wakeup_threshold, log a warning but continue. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
-rw-r--r--rngd_linux.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/rngd_linux.c b/rngd_linux.c
index 3556fd0..46db951 100644
--- a/rngd_linux.c
+++ b/rngd_linux.c
@@ -94,6 +94,7 @@ err:
void init_kernel_rng(const char* randomdev)
{
FILE *f;
+ int err;
random_fd = open(randomdev, O_RDWR);
if (random_fd == -1) {
@@ -103,9 +104,17 @@ void init_kernel_rng(const char* randomdev)
}
f = fopen("/proc/sys/kernel/random/write_wakeup_threshold", "w");
- if (f) {
+ if (!f) {
+ err = 1;
+ } else {
fprintf(f, "%u\n", arguments->fill_watermark);
- fclose(f);
+ /* Note | not || here... we always want to close the file */
+ err = ferror(f) | fclose(f);
+ }
+ if (err) {
+ message(LOG_DAEMON|LOG_WARNING,
+ "unable to adjust write_wakeup_threshold: %s",
+ strerror(errno));
}
}