]> andersk Git - openssh.git/blobdiff - ssh-rand-helper.c
- djm@cvs.openbsd.org 2006/07/10 11:25:53
[openssh.git] / ssh-rand-helper.c
index 3a4a165fa399708450a1e6e67288194d5dcc04c6..feb1bfb1834de675888e625f73b6ecc27f7eefb5 100644 (file)
 #include <sys/resource.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
 
 #ifdef HAVE_SYS_UN_H
 # include <sys/un.h>
 #endif
 
+#include <pwd.h>
 #include <signal.h>
 
 #include <openssl/rand.h>
@@ -573,7 +577,8 @@ prng_write_seedfile(void)
        /* Try to ensure that the parent directory is there */
        snprintf(filename, sizeof(filename), "%.512s/%s", pw->pw_dir,
            _PATH_SSH_USER_DIR);
-       mkdir(filename, 0700);
+       if (mkdir(filename, 0700) < 0 && errno != EEXIST)
+               fatal("mkdir %.200s: %s", filename, strerror(errno));
 
        snprintf(filename, sizeof(filename), "%.512s/%s", pw->pw_dir,
            SSH_PRNG_SEED_FILE);
@@ -782,6 +787,7 @@ prng_read_commands(char *cmdfilename)
        debug("Loaded %d entropy commands from %.100s", cur_cmd,
            cmdfilename);
 
+       fclose(f);
        return cur_cmd < MIN_ENTROPY_SOURCES ? -1 : 0;
 }
 
This page took 0.0306070000000001 seconds and 4 git commands to generate.