summaryrefslogtreecommitdiffstats
path: root/ssh-rand-helper.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2006-05-17 14:24:56 +0200
committerDarren Tucker <dtucker@zip.com.au>2006-05-17 14:24:56 +0200
commitf58b29d51508057e729cd142396e28505bae50ab (patch)
treed2baf72007642780af8e53c5463d306d13332cbc /ssh-rand-helper.c
parenttypo (diff)
downloadopenssh-f58b29d51508057e729cd142396e28505bae50ab.tar.xz
openssh-f58b29d51508057e729cd142396e28505bae50ab.zip
- (dtucker) [ssh-rand-helper.c] Check return code of mkdir and fix file
pointer leak. From kjhall at us.ibm.com, found by coverity.
Diffstat (limited to 'ssh-rand-helper.c')
-rw-r--r--ssh-rand-helper.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ssh-rand-helper.c b/ssh-rand-helper.c
index 3a4a165fa..d88a246eb 100644
--- a/ssh-rand-helper.c
+++ b/ssh-rand-helper.c
@@ -573,7 +573,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)
+ fatal("mkdir: %s", strerror(errno));
snprintf(filename, sizeof(filename), "%.512s/%s", pw->pw_dir,
SSH_PRNG_SEED_FILE);
@@ -782,6 +783,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;
}