Remove file detection before removing existing file.

Fixes: f8b9a3bad467 ("net/mlx5: install a socket to exchange a file descriptor")

Signed-off-by: Xueming Li <xuemi...@mellanox.com>
---
 drivers/net/mlx5/mlx5_socket.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_socket.c b/drivers/net/mlx5/mlx5_socket.c
index 61c1a4a..fb80fb3 100644
--- a/drivers/net/mlx5/mlx5_socket.c
+++ b/drivers/net/mlx5/mlx5_socket.c
@@ -32,7 +32,6 @@
        };
        int ret;
        int flags;
-       struct stat file_stat;
 
        /*
         * Initialise the socket to communicate with the secondary
@@ -52,9 +51,7 @@
                goto out;
        snprintf(sun.sun_path, sizeof(sun.sun_path), "/var/tmp/%s_%d",
                 MLX5_DRIVER_NAME, priv->primary_socket);
-       ret = stat(sun.sun_path, &file_stat);
-       if (!ret)
-               claim_zero(remove(sun.sun_path));
+       remove(sun.sun_path);
        ret = bind(priv->primary_socket, (const struct sockaddr *)&sun,
                   sizeof(sun));
        if (ret < 0) {
-- 
1.8.3.1

Reply via email to