This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate change #12146 from maintperl;
authorJarkko Hietaniemi <jhi@iki.fi>
Sat, 22 Sep 2001 23:25:02 +0000 (23:25 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Sat, 22 Sep 2001 23:25:02 +0000 (23:25 +0000)
win32_chdir() et al don't handle a NULL argument gracefully

p4raw-link: @12146 on //depot/maint-5.6/perl: 4e267243e0f1e4a79c99c8aa048aeec9c0d5cd6f

p4raw-id: //depot/perl@12147
p4raw-integrated: from //depot/maint-5.6/perl@12144 'merge in'
win32/perlhost.h (@11401..) win32/win32.c (@12026..)

win32/perlhost.h
win32/win32.c

index a417f66..1714601 100644 (file)
@@ -2368,6 +2368,10 @@ CPerlHost::Chdir(const char *dirname)
 {
     dTHX;
     int ret;
+    if (!dirname) {
+       errno = ENOENT;
+       return -1;
+    }
     if (USING_WIDE()) {
        WCHAR wBuffer[MAX_PATH];
        A2WHELPER(dirname, wBuffer, sizeof(wBuffer));
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));