if (result != existing && existing != SEM_FAILED)
if (result != existing && existing != SEM_FAILED && existing != MAP_FAILED)
check_add_mapping (const char *name, size_t namelen, int fd, sem_t *existing){  sem_t *result = SEM_FAILED;  /* Get the information about the file.  */  struct stat64 st;  if (__fxstat64 (_STAT_VER, fd, &st) == 0)    {      /* Get the lock.  */      lll_lock (__sem_mappings_lock);      /* Search for an existing mapping given the information we have.  */      struct inuse_sem *fake;      fake = (struct inuse_sem *) alloca (sizeof (*fake) + namelen);      memcpy (fake->name, name, namelen);      fake->dev = st.st_dev;      fake->ino = st.st_ino;      struct inuse_sem **foundp = tfind (fake, &__sem_mappings, __sem_search);      if (foundp != NULL)	{	  /* There is already a mapping.  Use it.  */	  result = (*foundp)->sem;	  ++(*foundp)->refcnt;	}      else if (existing != SEM_FAILED)	{	  /* We haven't found a mapping but the caller has a mapping.	     Install it.  */	  struct inuse_sem *newp;	  newp = (struct inuse_sem *) malloc (sizeof (*newp) + namelen);	  if (newp != NULL)	    {	      newp->dev = st.st_dev;	      newp->ino = st.st_ino;	      newp->refcnt = 1;	      newp->sem = existing;	      memcpy (newp->name, name, namelen);	      /* Insert the new value.  */	      if (tsearch (newp, &__sem_mappings, __sem_search) != NULL)		/* Successful.  */		result = existing;	      else		/* Something went wrong while inserting the new		   value.  We fail completely.  */		free (newp);	    }	}      /* Release the lock.  */      lll_unlock (__sem_mappings_lock);    }  if (result != existing && existing != SEM_FAILED)    {      /* Do not disturb errno.  */      INTERNAL_SYSCALL_DECL (err);      INTERNAL_SYSCALL (munmap, err, 2, existing, sizeof (sem_t));    }  return result;}