win32_opendir() fails on empty drives
Anton Berezin [Thu, 29 Oct 1998 17:06:25 +0000 (18:06 +0100)]
Message-ID: <86pvbbuzcu.fsf@lion.plab.ku.dk>

p4raw-id: //depot/perl@2148

win32/win32.c

index 53c9713..9e41d74 100644 (file)
@@ -657,6 +657,10 @@ win32_opendir(char *filename)
     /* do the FindFirstFile call */
     fh = FindFirstFile(scanname, &FindData);
     if (fh == INVALID_HANDLE_VALUE) {
+       /* FindFirstFile() fails on empty drives! */
+       if (GetLastError() == ERROR_FILE_NOT_FOUND)
+           return p;
+       Safefree( p);
        return NULL;
     }