From e92b7d3126763769a5e82f724b7307bdc602b2a0 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Wed, 6 Aug 2008 18:47:06 +0000 Subject: [PATCH] Check fstat result. Close fd on error git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20624 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/kdb/kdb_log.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); } -- 2.26.2