Added CMake building system for libmemif
[vpp.git] / extras / libmemif / src / socket.c
index 7c4bbd4..e1c3bd4 100644 (file)
@@ -375,7 +375,6 @@ memif_msg_receive_init (memif_socket_t * ms, int fd, memif_msg_t * msg)
   uint8_t err_string[96];
   memset (err_string, 0, sizeof (char) * 96);
   int err = MEMIF_ERR_SUCCESS; /* 0 */
-  int err_disc;
   if (i->version != MEMIF_VERSION)
     {
       DBG ("MEMIF_VER_ERR");
@@ -506,7 +505,8 @@ memif_msg_receive_add_region (memif_connection_t * c, memif_msg_t * msg,
   c->regions[ar->index].region_size = ar->size;
   c->regions[ar->index].addr = NULL;
 
-  if (lm->get_external_region_addr)
+  /* region 0 is never external */
+  if (lm->get_external_region_addr && (ar->index != 0))
     c->regions[ar->index].is_external = 1;
 
   return MEMIF_ERR_SUCCESS;    /* 0 */
@@ -690,7 +690,6 @@ memif_msg_receive (int ifd)
        return MEMIF_ERR_MFMSG;
     }
 
-  struct ucred *cr = 0;
   struct cmsghdr *cmsg;
 
   cmsg = CMSG_FIRSTHDR (&mh);
@@ -700,7 +699,7 @@ memif_msg_receive (int ifd)
        {
          if (cmsg->cmsg_type == SCM_CREDENTIALS)
            {
-             cr = (struct ucred *) CMSG_DATA (cmsg);
+             /* Do nothing */ ;
            }
          else if (cmsg->cmsg_type == SCM_RIGHTS)
            {