summaryrefslogtreecommitdiff
path: root/src/random-seed/random-seed.c
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-11-28 19:29:59 +0100
committerMichal Schmidt <mschmidt@redhat.com>2014-11-28 19:49:27 +0100
commit56f64d95763a799ba4475daf44d8e9f72a1bd474 (patch)
tree4c38253c718dc1972b811fa7c01ebfa3c2b7776c /src/random-seed/random-seed.c
parent895b3a7b44fe7ca2f260986be2a877ff56a72718 (diff)
treewide: use log_*_errno whenever %m is in the format string
If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
Diffstat (limited to 'src/random-seed/random-seed.c')
-rw-r--r--src/random-seed/random-seed.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/random-seed/random-seed.c b/src/random-seed/random-seed.c
index 7714bcef9f..40eaaf46d9 100644
--- a/src/random-seed/random-seed.c
+++ b/src/random-seed/random-seed.c
@@ -86,7 +86,7 @@ int main(int argc, char *argv[]) {
if (seed_fd < 0) {
seed_fd = open(RANDOM_SEED, O_RDONLY|O_CLOEXEC|O_NOCTTY);
if (seed_fd < 0) {
- log_error("Failed to open " RANDOM_SEED ": %m");
+ log_error_errno(errno, "Failed to open " RANDOM_SEED ": %m");
r = -errno;
goto finish;
}
@@ -96,7 +96,7 @@ int main(int argc, char *argv[]) {
if (random_fd < 0) {
random_fd = open("/dev/urandom", O_WRONLY|O_CLOEXEC|O_NOCTTY, 0600);
if (random_fd < 0) {
- log_error("Failed to open /dev/urandom: %m");
+ log_error_errno(errno, "Failed to open /dev/urandom: %m");
r = -errno;
goto finish;
}
@@ -106,7 +106,7 @@ int main(int argc, char *argv[]) {
if (k <= 0) {
if (r != 0)
- log_error("Failed to read seed from " RANDOM_SEED ": %m");
+ log_error_errno(errno, "Failed to read seed from " RANDOM_SEED ": %m");
r = k == 0 ? -EIO : (int) k;
@@ -125,14 +125,14 @@ int main(int argc, char *argv[]) {
seed_fd = open(RANDOM_SEED, O_WRONLY|O_CLOEXEC|O_NOCTTY|O_CREAT, 0600);
if (seed_fd < 0) {
- log_error("Failed to open " RANDOM_SEED ": %m");
+ log_error_errno(errno, "Failed to open " RANDOM_SEED ": %m");
r = -errno;
goto finish;
}
random_fd = open("/dev/urandom", O_RDONLY|O_CLOEXEC|O_NOCTTY);
if (random_fd < 0) {
- log_error("Failed to open /dev/urandom: %m");
+ log_error_errno(errno, "Failed to open /dev/urandom: %m");
r = -errno;
goto finish;
}