return;
error:
- if (sockfd > 0) {
+ if (sockfd >= 0) {
close(sockfd);
sockfd = -1;
}
rte_vdev_device_name(pmd->vdev), key, strerror(errno));
if (sock != NULL)
rte_free(sock);
+ if (sockfd >= 0)
+ close(sockfd);
return NULL;
}
struct memif_socket *socket = NULL;
struct memif_socket_dev_list_elt *elt, *next;
struct rte_hash *hash;
+ int ret;
hash = rte_hash_find_existing(MEMIF_SOCKET_HASH_NAME);
if (hash == NULL)
/* remove listener socket file,
* so we can create new one later.
*/
- remove(socket->filename);
+ ret = remove(socket->filename);
+ if (ret < 0)
+ MIF_LOG(ERR, "Failed to remove socket file: %s",
+ socket->filename);
}
rte_free(socket);
}
return 0;
error:
- if (sockfd > 0) {
+ if (sockfd >= 0) {
close(sockfd);
sockfd = -1;
}