Check fstat result. Close fd on error
authorKen Raeburn <raeburn@mit.edu>
Wed, 6 Aug 2008 18:47:06 +0000 (18:47 +0000)
committerKen Raeburn <raeburn@mit.edu>
Wed, 6 Aug 2008 18:47:06 +0000 (18:47 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20624 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/kdb/kdb_log.c

index be5853ccc574656ae8f361eb6b1d92a6dc049594..8d24857ab367ade5673f497fd155bfc842ba4546 100644 (file)
@@ -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);
     }