Unlink file after binding to it.
authorArmin Novak <armin.novak@thincast.com>
Mon, 25 Sep 2017 08:35:24 +0000 (10:35 +0200)
committerArmin Novak <armin.novak@thincast.com>
Mon, 25 Sep 2017 08:35:24 +0000 (10:35 +0200)
When unlinking the file before binding, a new entry is created
in the file system after binding. This is not desireable, so
unlink it after binding to remove the temporary file after the process
closes.

libfreerdp/core/listener.c

index 6fb48c8..7dade73 100644 (file)
@@ -185,9 +185,9 @@ static BOOL freerdp_listener_open_local(freerdp_listener* instance, const char*
 
        addr.sun_family = AF_UNIX;
        strncpy(addr.sun_path, path, sizeof(addr.sun_path));
-       unlink(path);
 
        status = _bind(sockfd, (struct sockaddr*) &addr, sizeof(addr));
+       unlink(path);
 
        if (status != 0)
        {