- (dtucker) [ssh-rand-helper.c] Check return code of mkdir and fix file

pointer leak.  From kjhall at us.ibm.com, found by coverity.
This commit is contained in:
Darren Tucker 2006-05-17 22:24:56 +10:00
parent 73373877db
commit f58b29d515
2 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,7 @@
20050517
- (dtucker) [ssh-rand-helper.c] Check return code of mkdir and fix file
pointer leak. From kjhall at us.ibm.com, found by coverity.
20050515
- (dtucker) [openbsd-compat/getrrsetbyname.c] Use _compat_res instead of
_res, prevents problems on some platforms that have _res as a global but
@ -4621,4 +4625,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
$Id: ChangeLog,v 1.4328 2006/05/15 07:24:25 dtucker Exp $
$Id: ChangeLog,v 1.4329 2006/05/17 12:24:56 dtucker Exp $

View File

@ -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;
}