summaryrefslogtreecommitdiff
path: root/src/random-seed
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-07-22 10:24:50 +0200
committerLennart Poettering <lennart@poettering.net>2019-07-25 18:20:50 +0200
commitc6127c39965aa7f13ee8b311e3f89f6f3c54a730 (patch)
treeafb0c3fb7c0f6683394851798da659a03bbd58c1 /src/random-seed
parent15d961bf537435914736005a857b33750b13848b (diff)
downloadsystemd-c6127c39965aa7f13ee8b311e3f89f6f3c54a730.tar.gz
random-seed: drop falling back to O_WRONLY if O_RDWR on /dev/urandom doesn't work
There's no reason why writing should work if reading and writing doesn't. Let's simplify this hence. /dev/urandom is generally an r/w device, and everything else would be a serious system misconfiguration.
Diffstat (limited to 'src/random-seed')
-rw-r--r--src/random-seed/random-seed.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/random-seed/random-seed.c b/src/random-seed/random-seed.c
index 1a1ce8caa4..dc148ebc86 100644
--- a/src/random-seed/random-seed.c
+++ b/src/random-seed/random-seed.c
@@ -67,13 +67,8 @@ static int run(int argc, char *argv[]) {
write_seed_file = true;
random_fd = open("/dev/urandom", O_RDWR|O_CLOEXEC|O_NOCTTY, 0600);
- if (random_fd < 0) {
- write_seed_file = false;
-
- random_fd = open("/dev/urandom", O_WRONLY|O_CLOEXEC|O_NOCTTY, 0600);
- if (random_fd < 0)
- return log_error_errno(errno, "Failed to open /dev/urandom: %m");
- }
+ if (random_fd < 0)
+ return log_error_errno(errno, "Failed to open /dev/urandom: %m");
read_seed_file = true;