naccyde / rpms / systemd

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