Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Rev 34 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
79 magnus 1
Author: Magnus Holmgren <holmgren@debian.org>
2
Description: Show the intended error message when no seed file exists
3
 (instead of one about a locking error)
21 magnus 4
 
5
diff -urNad trunk~/src/unix_random.c trunk/src/unix_random.c
6
--- trunk~/src/unix_random.c    2006-01-23 18:47:10.000000000 +0100
7
+++ trunk/src/unix_random.c     2008-06-24 22:29:29.000000000 +0200
8
@@ -353,6 +353,15 @@
9
 
10
     yarrow256_init(&self->yarrow, RANDOM_NSOURCES, self->sources);
11
 
12
+    if (access(lsh_get_cstring(seed_file_name), F_OK) < 0)
13
+      {
14
+       werror("No seed file. Please create one by running\n");
15
+       werror("lsh-make-seed -o \"%S\".\n", seed_file_name);
16
+
17
+       KILL(self);
18
+       return NULL;
19
+      }
20
+
21
     verbose("Reading seed-file `%S'\n", seed_file_name);
22
 
23
     self->lock
24
@@ -374,8 +383,7 @@
25
     self->seed_file_fd = open(lsh_get_cstring(seed_file_name), O_RDWR);
26
     if (self->seed_file_fd < 0)
27
       {
28
-       werror("No seed file. Please create one by running\n");
29
-       werror("lsh-make-seed -o \"%S\".\n", seed_file_name);
30
+       werror("Could not open seed file \"%S\".\n", seed_file_name);
31
 
32
        KILL_RESOURCE(lock);
33
        KILL(self);