From: Ouyang Changchun Date: Mon, 3 Nov 2014 08:11:53 +0000 (+0800) Subject: vhost: fix mem path check X-Git-Tag: spdx-start~10182 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=4e3eff86cf8090604ff869001d999dc4bfaad617;p=dpdk.git vhost: fix mem path check Commit aec8283d47 fixes the compilation issue, but it leads to one runtime issue: early exit wrongly. In some case, 'path' is NULL, but 'resolved_path' has effective path, it should continue going ahead rather than exit. This is due to that qemu unlink the file after it maps the huge page file. In this special case, it is ok to check the resolved path when path is NULL if errno indicates "No such file or directory". Signed-off-by: Changchun Ouyang Acked-by: Huawei Xie --- diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c index 50cab24ce8..6d8de09430 100644 --- a/lib/librte_vhost/virtio-net.c +++ b/lib/librte_vhost/virtio-net.c @@ -247,7 +247,7 @@ host_memory_map(struct virtio_net *dev, struct virtio_memory *mem, snprintf(memfile, PATH_MAX, "/proc/%u/fd/%s", pid, dptr->d_name); path = realpath(memfile, resolved_path); - if (path == NULL) { + if ((path == NULL) && (strlen(resolved_path) == 0)) { RTE_LOG(ERR, VHOST_CONFIG, "(%"PRIu64") Failed to resolve fd directory\n", dev->device_fh);