This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Get Cwd->cwd() to work under Cygwin
authorJerry D. Hedden <jdhedden@cpan.org>
Wed, 15 Aug 2007 10:39:41 +0000 (06:39 -0400)
committerSteve Peters <steve@fisharerojo.org>
Mon, 20 Aug 2007 13:16:19 +0000 (13:16 +0000)
From: "Jerry D. Hedden" <jdhedden@cpan.org>
Message-ID: <1ff86f510708150739q18fa5863s55010b538d11f77f@mail.gmail.com>

Updated patch originally by Reini Urban.

p4raw-id: //depot/perl@31737

cygwin/cygwin.c
t/lib/cygwin.t

index 84915f8..60d7d94 100644 (file)
@@ -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));
index 3623f9a..7f2f655 100644 (file)
@@ -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");