From: Jerry D. Hedden Date: Wed, 15 Aug 2007 10:39:41 +0000 (-0400) Subject: Get Cwd->cwd() to work under Cygwin X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=482150a7b7fa28a4cdcbe9eb32bbd0a420918766;p=p5sagit%2Fp5-mst-13.2.git Get Cwd->cwd() to work under Cygwin From: "Jerry D. Hedden" Message-ID: <1ff86f510708150739q18fa5863s55010b538d11f77f@mail.gmail.com> Updated patch originally by Reini Urban. p4raw-id: //depot/perl@31737 --- diff --git a/cygwin/cygwin.c b/cygwin/cygwin.c index 84915f8..60d7d94 100644 --- a/cygwin/cygwin.c +++ b/cygwin/cygwin.c @@ -145,7 +145,10 @@ XS(Cygwin_cwd) dXSARGS; char *cwd; - if(items != 0) + /* See http://rt.perl.org/rt3/Ticket/Display.html?id=38628 + There is Cwd->cwd() usage in the wild, and previous versions didn't die. + */ + if(items > 1) Perl_croak(aTHX_ "Usage: Cwd::cwd()"); if((cwd = getcwd(NULL, -1))) { ST(0) = sv_2mortal(newSVpv(cwd, 0)); diff --git a/t/lib/cygwin.t b/t/lib/cygwin.t index 3623f9a..7f2f655 100644 --- a/t/lib/cygwin.t +++ b/t/lib/cygwin.t @@ -9,7 +9,7 @@ BEGIN { } } -use Test::More tests => 14; +use Test::More tests => 15; is(Cygwin::winpid_to_pid(Cygwin::pid_to_winpid($$)), $$, "perl pid translates to itself"); @@ -59,3 +59,5 @@ for $i (@mnttbl) { is($i->[2].",".$i->[3], $rootmnt, "same root mount flags"); } } + +ok(Cwd->cwd(), "bug#38628 legacy");