Use stat instead of lstat to iterate /Volumes
authorArmin Novak <armin.novak@thincast.com>
Thu, 12 Sep 2019 12:35:01 +0000 (14:35 +0200)
committerArmin Novak <armin.novak@thincast.com>
Thu, 12 Sep 2019 12:35:01 +0000 (14:35 +0200)
Some entries are symbolic links, so follow them and check the link
target for being a directory.

channels/rdpdr/client/rdpdr_main.c

index b7e88c0..af78c68 100644 (file)
@@ -405,7 +405,8 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
                if (pDirent->d_name[0] != '.')
                {
                        sprintf_s(fullpath, ARRAYSIZE(fullpath), "%s/%s", szdir, pDirent->d_name);
-                       lstat(fullpath, &buf);
+                       if (stat(fullpath, &buf) != 0)
+                               continue;
 
                        if (S_ISDIR(buf.st_mode))
                        {