From: Ken Raeburn Date: Wed, 6 Aug 2008 18:47:06 +0000 (+0000) Subject: Check fstat result. Close fd on error X-Git-Tag: krb5-1.7-alpha1~520 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e92b7d3126763769a5e82f724b7307bdc602b2a0;p=krb5.git Check fstat result. Close fd on error git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20624 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/kdb/kdb_log.c b/src/lib/kdb/kdb_log.c index be5853ccc..8d24857ab 100644 --- a/src/lib/kdb/kdb_log.c +++ b/src/lib/kdb/kdb_log.c @@ -590,7 +590,10 @@ ulog_map(krb5_context context, const char *logname, uint32_t ulogentries, } if (caller == FKPROPLOG) { - fstat(ulogfd, &st); + if (fstat(ulogfd, &st) < 0) { + close(ulogfd); + return errno; + } ulog_filesize = st.st_size; ulog = (kdb_hlog_t *)mmap(0, ulog_filesize, @@ -607,6 +610,7 @@ ulog_map(krb5_context context, const char *logname, uint32_t ulogentries, /* * Can't map update log file to memory */ + close(ulogfd); return (errno); }