diff options
author | Franck Bui <fbui@suse.com> | 2022-10-20 15:03:20 +0200 |
---|---|---|
committer | Franck Bui <fbui@suse.com> | 2022-10-25 12:16:22 +0200 |
commit | 3f6fbfe6f1ae62b080c70dad6de5a65108e3d538 (patch) | |
tree | 36da136218962671fa9c9450b5a5b92442eb3000 /src/random-seed | |
parent | random-seed: split out run() (diff) | |
download | systemd-3f6fbfe6f1ae62b080c70dad6de5a65108e3d538.tar.xz systemd-3f6fbfe6f1ae62b080c70dad6de5a65108e3d538.zip |
random_seed: minor improvement in run()
Diffstat (limited to 'src/random-seed')
-rw-r--r-- | src/random-seed/random-seed.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/random-seed/random-seed.c b/src/random-seed/random-seed.c index 991e4b8ddd..05fb5bb157 100644 --- a/src/random-seed/random-seed.c +++ b/src/random-seed/random-seed.c @@ -410,12 +410,12 @@ static int run(int argc, char *argv[]) { seed_fd = open(RANDOM_SEED, O_RDONLY|O_CLOEXEC|O_NOCTTY); if (seed_fd < 0) { bool missing = errno == ENOENT; + int level = missing ? LOG_DEBUG : LOG_ERR; - log_full_errno(missing ? LOG_DEBUG : LOG_ERR, - open_rw_error, "Failed to open " RANDOM_SEED " for writing: %m"); - r = log_full_errno(missing ? LOG_DEBUG : LOG_ERR, - errno, "Failed to open " RANDOM_SEED " for reading: %m"); - return missing ? 0 : r; + log_full_errno(level, open_rw_error, "Failed to open " RANDOM_SEED " for writing: %m"); + log_full_errno(level, errno, "Failed to open " RANDOM_SEED " for reading: %m"); + + return missing ? 0 : -errno; } } else write_seed_file = true; |