summaryrefslogtreecommitdiff
path: root/src/random-seed
diff options
context:
space:
mode:
Diffstat (limited to 'src/random-seed')
-rw-r--r--src/random-seed/random-seed.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/random-seed/random-seed.c b/src/random-seed/random-seed.c
index 40eaaf46d9..06c1239601 100644
--- a/src/random-seed/random-seed.c
+++ b/src/random-seed/random-seed.c
@@ -113,12 +113,9 @@ int main(int argc, char *argv[]) {
} else {
lseek(seed_fd, 0, SEEK_SET);
- k = loop_write(random_fd, buf, (size_t) k, false);
- if (k <= 0) {
- log_error("Failed to write seed to /dev/urandom: %s", r < 0 ? strerror(-r) : "short write");
-
- r = k == 0 ? -EIO : (int) k;
- }
+ r = loop_write(random_fd, buf, (size_t) k, false);
+ if (r < 0)
+ log_error_errno(r, "Failed to write seed to /dev/urandom: %m");
}
} else if (streq(argv[1], "save")) {
@@ -155,10 +152,8 @@ int main(int argc, char *argv[]) {
r = k == 0 ? -EIO : (int) k;
} else {
r = loop_write(seed_fd, buf, (size_t) k, false);
- if (r <= 0) {
- log_error("Failed to write new random seed file: %s", r < 0 ? strerror(-r) : "short write");
- r = r == 0 ? -EIO : r;
- }
+ if (r < 0)
+ log_error_errno(r, "Failed to write new random seed file: %m");
}
finish: