summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2010-09-20 10:04:10 -0300
committerLennart Poettering <lennart@poettering.net>2010-09-20 23:12:50 +0200
commitb56e57470c92f123044ea690b5404bdd730ddaa6 (patch)
tree5c8aa1b63de601b6d4fd7668cd056bfba1641f52
parent26febd4590469579eb74e2d92c3fa137645f2286 (diff)
random-seed: create parents of RANDOM_SEED if they do not exist.
it may happen that parent directories of RANDOM_SEED do not exist, in that case we must create it otherwise save will not work.
-rw-r--r--src/random-seed.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/random-seed.c b/src/random-seed.c
index 936ed4791b..8eab2b4e1c 100644
--- a/src/random-seed.c
+++ b/src/random-seed.c
@@ -61,6 +61,11 @@ int main(int argc, char *argv[]) {
goto finish;
}
+ if (mkdir_parents(RANDOM_SEED, 0755) < 0) {
+ log_error("Failed to create directories parents of %s: %m", RANDOM_SEED);
+ goto finish;
+ }
+
/* When we load the seed we read it and write it to the device
* and then immediately update the saved seed with new data,
* to make sure the next boot gets seeded differently. */