vhost: fix build without unused result
authorOuyang Changchun <changchun.ouyang@intel.com>
Wed, 29 Oct 2014 06:39:38 +0000 (14:39 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 29 Oct 2014 23:19:41 +0000 (00:19 +0100)
It fixes this compilation complain: "error: ignoring return value of 'realpath',
declared with attribute warn_unused_result [-Werror=unused-result]"

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Tested-by: Jingguo Fu <jingguox.fu@intel.com>
lib/librte_vhost/virtio-net.c

index 27ba175..8015dd8 100644 (file)
@@ -133,6 +133,7 @@ host_memory_map(struct virtio_net *dev, struct virtio_memory *mem,
        char mapfile[PATH_MAX];
        char procdir[PATH_MAX];
        char resolved_path[PATH_MAX];
+       char *path = NULL;
        FILE            *fmap;
        void            *map;
        uint8_t         found = 0;
@@ -235,9 +236,11 @@ host_memory_map(struct virtio_net *dev, struct virtio_memory *mem,
        while (NULL != (dptr = readdir(dp))) {
                snprintf(memfile, PATH_MAX, "/proc/%u/fd/%s",
                                pid, dptr->d_name);
-           realpath(memfile, resolved_path);
-               if (resolved_path == NULL) {
-                       RTE_LOG(ERR, VHOST_CONFIG, "(%"PRIu64") Failed to resolve fd directory\n", dev->device_fh);
+               path = realpath(memfile, resolved_path);
+               if (path == NULL) {
+                       RTE_LOG(ERR, VHOST_CONFIG,
+                               "(%"PRIu64") Failed to resolve fd directory\n",
+                               dev->device_fh);
                        closedir(dp);
                        return -1;
                }