Fix prior
authorRoy Marples <roy@marples.name>
Fri, 8 Sep 2017 19:47:41 +0000 (20:47 +0100)
committerRoy Marples <roy@marples.name>
Fri, 8 Sep 2017 19:47:41 +0000 (20:47 +0100)
src/libdhcpcd/wpa.c

index c7e57dbf69ac48e4ec1ecdd2d121ec5d5b0b1b38..baf674bf11a6c6df9d2773ee9d499405ef539ea8 100644 (file)
@@ -104,9 +104,11 @@ wpa_open(const char *ifname, char **path)
 out:
        free(pwdbuf);
        free(tmpdir);
+       if (r == 0)
+               return fd;
        if (fd != -1)
                close(fd);
-       if (r != 0 && *path != NULL) {
+       if (*path != NULL) {
                unlink(*path);
                free(*path);
                *path = NULL;