This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate change #12146 from maintperl;
[perl5.git] / win32 / win32.c
index eacb248..30d63c6 100644 (file)
@@ -3008,7 +3008,11 @@ win32_rmdir(const char *dir)
 DllExport int
 win32_chdir(const char *dir)
 {
-    dTHX;
+    dTHXo;
+    if (!dir) {
+       errno = ENOENT;
+       return -1;
+    }
     if (USING_WIDE()) {
        WCHAR wBuffer[MAX_PATH+1];
        A2WHELPER(dir, wBuffer, sizeof(wBuffer));