ryantimwilson / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
Blob Blame History Raw
From 2fee90a7564f87472c39238b3345025dd383ce60 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 12 Nov 2013 22:05:16 -0500
Subject: [PATCH] random-seed: improve debugging messages a bit

---
 Makefile.am                   | 2 ++
 src/random-seed/random-seed.c | 8 ++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 910e780..16a5c3c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -159,6 +159,7 @@ AM_CPPFLAGS = \
 	-DSYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH=\"$(rootbindir)/systemd-tty-ask-password-agent\" \
 	-DSYSTEMD_STDIO_BRIDGE_BINARY_PATH=\"$(bindir)/systemd-stdio-bridge\" \
 	-DROOTPREFIX=\"$(rootprefix)\" \
+	-DRANDOM_SEED_DIR=\"$(localstatedir)/lib/systemd/\" \
 	-DRANDOM_SEED=\"$(localstatedir)/lib/systemd/random-seed\" \
 	-DSYSTEMD_CRYPTSETUP_PATH=\"$(rootlibexecdir)/systemd-cryptsetup\" \
 	-DSYSTEM_GENERATOR_PATH=\"$(systemgeneratordir)\" \
@@ -4242,6 +4243,7 @@ substitutions = \
        '|PACKAGE_VERSION=$(PACKAGE_VERSION)|' \
        '|PACKAGE_NAME=$(PACKAGE_NAME)|' \
        '|PACKAGE_URL=$(PACKAGE_URL)|' \
+       '|RANDOM_SEED_DIR=$(localstatedir)/lib/systemd/|' \
        '|RANDOM_SEED=$(localstatedir)/lib/systemd/random-seed|' \
        '|prefix=$(prefix)|' \
        '|exec_prefix=$(exec_prefix)|' \
diff --git a/src/random-seed/random-seed.c b/src/random-seed/random-seed.c
index afbd500..af79ecf 100644
--- a/src/random-seed/random-seed.c
+++ b/src/random-seed/random-seed.c
@@ -72,7 +72,7 @@ int main(int argc, char *argv[]) {
 
         r = mkdir_parents_label(RANDOM_SEED, 0755);
         if (r < 0) {
-                log_error("Failed to create parent directory of " RANDOM_SEED ": %s", strerror(-r));
+                log_error("Failed to create directory " RANDOM_SEED_DIR ": %s", strerror(-r));
                 goto finish;
         }
 
@@ -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("Failed to open " RANDOM_SEED ": %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 file: %m");
+                                log_error("Failed to read seed from " RANDOM_SEED ": %m");
 
                         r = k == 0 ? -EIO : (int) k;
 
@@ -125,7 +125,7 @@ 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("Failed to open " RANDOM_SEED ": %m");
                         r = -errno;
                         goto finish;
                 }