We've had  a long-standing problem that autoloading does things it 
shouldn't to errno.  At least one root cause of this is our 
home-grown flex_stat(), which can pick up errno values from various 
subsidiary calls.  The change here makes it save errno and restore it 
when it is successful.  This crosses posix.t #30 off our to-do list 
and otherwise leaves the test score unaffected.

--- ext/POSIX/t/posix.t;-0      Wed Mar 20 15:10:39 2002
+++ ext/POSIX/t/posix.t Sun Mar 24 16:03:52 2002
@@ -178,10 +178,6 @@
        my $foo  = $!;
        my $errno = POSIX::errno();
 
-        local $TODO;
-        $TODO = 'POSIX::errno() munged by autoloading on VMS' 
-            if $Is_VMS && $test == 0;
-
         # Force numeric context.
        is( $errno + 0, $foo + 0,     'autoloading and errno() mix' );
     }
--- vms/vms.c;-1        Sat Mar 23 19:19:13 2002
+++ vms/vms.c   Sun Mar 24 15:44:20 2002
@@ -6706,8 +6706,10 @@
     char fileified[NAM$C_MAXRSS+1];
     char temp_fspec[NAM$C_MAXRSS+300];
     int retval = -1;
+    int saved_errno, saved_vaxc_errno;
 
     if (!fspec) return retval;
+    saved_errno = errno; saved_vaxc_errno = vaxc$errno;
     strcpy(temp_fspec, fspec);
     if (statbufp == (Stat_t *) &PL_statcache)
       do_tovmsspec(temp_fspec,namecache,0);
@@ -6758,6 +6760,8 @@
       }
 #     endif
     }
+    /* If we were successful, leave errno where we found it */
+    if (retval == 0) { errno = saved_errno; vaxc$errno = saved_vaxc_errno; }
     return retval;
 
 }  /* end of flex_stat() */
[end of patch]
-- 
________________________________________
Craig A. Berry
mailto:[EMAIL PROTECTED]

"... getting out of a sonnet is much more
 difficult than getting in."
                 Brad Leithauser

Reply via email to