572a44
From 03269523c0f254846613ae3ae0183f4724e47ed8 Mon Sep 17 00:00:00 2001
572a44
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
572a44
Date: Tue, 12 Nov 2013 22:05:16 -0500
572a44
Subject: [PATCH] random-seed: improve debugging messages a bit
572a44
572a44
---
572a44
 Makefile.am                   | 2 ++
572a44
 src/random-seed/random-seed.c | 8 ++++----
572a44
 2 files changed, 6 insertions(+), 4 deletions(-)
572a44
572a44
diff --git a/Makefile.am b/Makefile.am
572a44
index 0c11477..3103bac 100644
572a44
--- a/Makefile.am
572a44
+++ b/Makefile.am
572a44
@@ -159,6 +159,7 @@ AM_CPPFLAGS = \
572a44
 	-DSYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH=\"$(rootbindir)/systemd-tty-ask-password-agent\" \
572a44
 	-DSYSTEMD_STDIO_BRIDGE_BINARY_PATH=\"$(bindir)/systemd-stdio-bridge\" \
572a44
 	-DROOTPREFIX=\"$(rootprefix)\" \
572a44
+	-DRANDOM_SEED_DIR=\"$(localstatedir)/lib/systemd/\" \
572a44
 	-DRANDOM_SEED=\"$(localstatedir)/lib/systemd/random-seed\" \
572a44
 	-DSYSTEMD_CRYPTSETUP_PATH=\"$(rootlibexecdir)/systemd-cryptsetup\" \
572a44
 	-DSYSTEM_GENERATOR_PATH=\"$(systemgeneratordir)\" \
572a44
@@ -4227,6 +4228,7 @@ substitutions = \
572a44
        '|PACKAGE_VERSION=$(PACKAGE_VERSION)|' \
572a44
        '|PACKAGE_NAME=$(PACKAGE_NAME)|' \
572a44
        '|PACKAGE_URL=$(PACKAGE_URL)|' \
572a44
+       '|RANDOM_SEED_DIR=$(localstatedir)/lib/systemd/|' \
572a44
        '|RANDOM_SEED=$(localstatedir)/lib/systemd/random-seed|' \
572a44
        '|prefix=$(prefix)|' \
572a44
        '|exec_prefix=$(exec_prefix)|' \
572a44
diff --git a/src/random-seed/random-seed.c b/src/random-seed/random-seed.c
572a44
index afbd500..af79ecf 100644
572a44
--- a/src/random-seed/random-seed.c
572a44
+++ b/src/random-seed/random-seed.c
572a44
@@ -72,7 +72,7 @@ int main(int argc, char *argv[]) {
572a44
 
572a44
         r = mkdir_parents_label(RANDOM_SEED, 0755);
572a44
         if (r < 0) {
572a44
-                log_error("Failed to create parent directory of " RANDOM_SEED ": %s", strerror(-r));
572a44
+                log_error("Failed to create directory " RANDOM_SEED_DIR ": %s", strerror(-r));
572a44
                 goto finish;
572a44
         }
572a44
 
572a44
@@ -86,7 +86,7 @@ int main(int argc, char *argv[]) {
572a44
                 if (seed_fd < 0) {
572a44
                         seed_fd = open(RANDOM_SEED, O_RDONLY|O_CLOEXEC|O_NOCTTY);
572a44
                         if (seed_fd < 0) {
572a44
-                                log_error("Failed to open random seed: %m");
572a44
+                                log_error("Failed to open " RANDOM_SEED ": %m");
572a44
                                 r = -errno;
572a44
                                 goto finish;
572a44
                         }
572a44
@@ -106,7 +106,7 @@ int main(int argc, char *argv[]) {
572a44
                 if (k <= 0) {
572a44
 
572a44
                         if (r != 0)
572a44
-                                log_error("Failed to read seed file: %m");
572a44
+                                log_error("Failed to read seed from " RANDOM_SEED ": %m");
572a44
 
572a44
                         r = k == 0 ? -EIO : (int) k;
572a44
 
572a44
@@ -125,7 +125,7 @@ int main(int argc, char *argv[]) {
572a44
 
572a44
                 seed_fd = open(RANDOM_SEED, O_WRONLY|O_CLOEXEC|O_NOCTTY|O_CREAT, 0600);
572a44
                 if (seed_fd < 0) {
572a44
-                        log_error("Failed to open random seed: %m");
572a44
+                        log_error("Failed to open " RANDOM_SEED ": %m");
572a44
                         r = -errno;
572a44
                         goto finish;
572a44
                 }