Add support for MAP-T CE (VPP-1058)
[vpp.git] / src / vppinfra / maplog.c
index 3e08973..deb07aa 100644 (file)
@@ -394,6 +394,7 @@ clib_maplog_process (char *file_basename, void *fp_arg)
       goto out;
     }
   (void) close (fd);
+  fd = -1;
 
   file_size_in_bytes = h->file_size_in_records
     * h->record_size_in_cachelines * CLIB_CACHE_LINE_BYTES;
@@ -415,6 +416,7 @@ clib_maplog_process (char *file_basename, void *fp_arg)
       file_baseva =
        mmap (0, file_size_in_bytes, PROT_READ, MAP_SHARED, fd, 0);
       (void) close (fd);
+      fd = -1;
       if (file_baseva == (u8 *) MAP_FAILED)
        {
          clib_unix_warning ("mmap");
@@ -439,7 +441,7 @@ clib_maplog_process (char *file_basename, void *fp_arg)
     }
 
 out:
-  if (fd > 0)
+  if (fd >= 0)
     (void) close (fd);
 
   vec_free (this_filename);