mk: build with _GNU_SOURCE defined by default
[dpdk.git] / drivers / net / mlx5 / mlx5_socket.c
index e12c4cb..0010617 100644 (file)
@@ -3,8 +3,6 @@
  * Copyright 2016 Mellanox Technologies, Ltd
  */
 
-#define _GNU_SOURCE
-
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
@@ -35,6 +33,12 @@ mlx5_socket_init(struct rte_eth_dev *dev)
        int ret;
        int flags;
 
+       /*
+        * Close the last socket that was used to communicate
+        * with the secondary process
+        */
+       if (priv->primary_socket)
+               mlx5_socket_uninit(dev);
        /*
         * Initialise the socket to communicate with the secondary
         * process.
@@ -294,7 +298,7 @@ mlx5_socket_connect(struct rte_eth_dev *dev)
        }
        ret = *fd;
        close(socket_fd);
-       return 0;
+       return ret;
 error:
        if (socket_fd != -1)
                close(socket_fd);