[dpdk-dev] [PATCH] librte_vhost: Fix the path test issue

Ouyang Changchun changchun.ouyang at intel.com
Mon Nov 3 09:11:53 CET 2014


Commit aec8283d47d4e4366b6 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.

Signed-off-by: Changchun Ouyang <changchun.ouyang at intel.com>
---
 lib/librte_vhost/virtio-net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
index 8015dd8..3fa1274 100644
--- a/lib/librte_vhost/virtio-net.c
+++ b/lib/librte_vhost/virtio-net.c
@@ -237,7 +237,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);
-- 
1.8.4.2



More information about the dev mailing list