From: Jarkko Hietaniemi Date: Sat, 22 Sep 2001 23:25:02 +0000 (+0000) Subject: Integrate change #12146 from maintperl; X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9ec3348ad1197752cfc299568cf84ab0e3b73793;p=p5sagit%2Fp5-mst-13.2.git Integrate change #12146 from maintperl; 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..) --- diff --git a/win32/perlhost.h b/win32/perlhost.h index a417f66..1714601 100644 --- a/win32/perlhost.h +++ b/win32/perlhost.h @@ -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)); diff --git a/win32/win32.c b/win32/win32.c index eacb248..30d63c6 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -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));