Change 18316 by [EMAIL PROTECTED] on 2002/12/17 02:17:16

        Subject: [PATCH 5.8.1 @oldish-18156] build
        From: Ilya Zakharevich <[EMAIL PROTECTED]>
        Date: Fri, 13 Dec 2002 13:54:05 -0800
        Message-ID: <[EMAIL PROTECTED]>

Affected files ...

... //depot/perl/os2/os2.c#64 edit
... //depot/perl/t/run/runenv.t#8 edit

Differences ...

==== //depot/perl/os2/os2.c#64 (text) ====
Index: perl/os2/os2.c
--- perl/os2/os2.c#63~18314~    Mon Dec 16 17:58:32 2002
+++ perl/os2/os2.c      Mon Dec 16 18:17:16 2002
@@ -2637,18 +2637,30 @@
 
 #undef rmdir
 
+/* EMX flavors do not tolerate trailing slashes.  t/op/mkdir.t has many
+   trailing slashes, so we need to support this as well. */
+
 int
 my_rmdir (__const__ char *s)
 {
-    char buf[MAXPATHLEN];
+    char b[MAXPATHLEN];
+    char *buf = b;
     STRLEN l = strlen(s);
+    int rc;
 
-    if (s[l-1] == '/' || s[l-1] == '\\') {     /* EMX rmdir fails... */
+    if (s[l-1] == '/' || s[l-1] == '\\') {     /* EMX mkdir fails... */
+       if (l >= sizeof b)
+           New(1305, buf, l + 1, char);
        strcpy(buf,s);
-       buf[l - 1] = 0;
+       while (l > 1 && (s[l-1] == '/' || s[l-1] == '\\'))
+           l--;
+       buf[l] = 0;
        s = buf;
     }
-    return rmdir(s);
+    rc = rmdir(s);
+    if (b != buf)
+       Safefree(buf);
+    return rc;
 }
 
 #undef mkdir
@@ -2656,15 +2668,24 @@
 int
 my_mkdir (__const__ char *s, long perm)
 {
-    char buf[MAXPATHLEN];
+    char b[MAXPATHLEN];
+    char *buf = b;
     STRLEN l = strlen(s);
+    int rc;
 
     if (s[l-1] == '/' || s[l-1] == '\\') {     /* EMX mkdir fails... */
+       if (l >= sizeof b)
+           New(1305, buf, l + 1, char);
        strcpy(buf,s);
-       buf[l - 1] = 0;
+       while (l > 1 && (s[l-1] == '/' || s[l-1] == '\\'))
+           l--;
+       buf[l] = 0;
        s = buf;
     }
-    return mkdir(s, perm);
+    rc = mkdir(s, perm);
+    if (b != buf)
+       Safefree(buf);
+    return rc;
 }
 
 #undef flock

==== //depot/perl/t/run/runenv.t#8 (text) ====
Index: perl/t/run/runenv.t
--- perl/t/run/runenv.t#7~18136~        Sun Nov 10 13:38:44 2002
+++ perl/t/run/runenv.t Mon Dec 16 18:17:16 2002
@@ -39,6 +39,10 @@
 
   $stdout = '' unless defined $stdout;
   $stderr = '' unless defined $stderr;
+  local %ENV = %ENV;
+  delete $ENV{PERLLIB};
+  delete $ENV{PERL5LIB};
+  delete $ENV{PERL5OPT};
   my $pid = fork;
   return (0, "Couldn't fork: $!") unless defined $pid;   # failure
   if ($pid) {                   # parent
@@ -149,22 +153,22 @@
     '1',
     '');
 
-try({PERLLIB => "foobar:42"},
+try({PERLLIB => "foobar$Config{path_sep}42"},
     ['-e', 'print grep { $_ eq "foobar" } @INC'],
     'foobar',
     '');
 
-try({PERLLIB => "foobar:42"},
+try({PERLLIB => "foobar$Config{path_sep}42"},
     ['-e', 'print grep { $_ eq "42" } @INC'],
     '42',
     '');
 
-try({PERL5LIB => "foobar:42"},
+try({PERL5LIB => "foobar$Config{path_sep}42"},
     ['-e', 'print grep { $_ eq "foobar" } @INC'],
     'foobar',
     '');
 
-try({PERL5LIB => "foobar:42"},
+try({PERL5LIB => "foobar$Config{path_sep}42"},
     ['-e', 'print grep { $_ eq "42" } @INC'],
     '42',
     '');
End of Patch.

Reply via email to