applied patch, with tab tweak suggest by Peter Prymmer
[p5sagit/p5-mst-13.2.git] / vms / vms.c
index ac5ac9c..46bad3b 100644 (file)
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -3925,6 +3925,7 @@ is_null_device(name)
 I32
 cando(I32 bit, I32 effective, Stat_t *statbufp)
 {
+  dTHR;
   if (statbufp == &statcache) return cando_by_name(bit,effective,namecache);
   else {
     char fname[NAM$C_MAXRSS+1];
@@ -4168,7 +4169,7 @@ my_binmode(FILE *fp, char iotype)
     if (s == dirend + 3) return fp;
     /* If we've got a non-file-structured device, clip off the trailing
      * junk, and don't lose sleep if we can't get a stream position.  */
-    if (dirend == Nullch) *(colon+1) = '\0';
+    if (dirend == Nullch) *(colon+1) = '\0'; 
     if (iotype != '-'&& (ret = fgetpos(fp, &pos)) == -1 && dirend) return NULL;
     switch (iotype) {
       case '<': case 'r':           acmode = "rb";                      break;
@@ -4178,8 +4179,12 @@ my_binmode(FILE *fp, char iotype)
       case 'a':                     acmode = "ab";                      break;
       case '+':  case 's':          acmode = "rb+";                     break;
       case '-':                     acmode = fileno(fp) ? "ab" : "rb";  break;
+      /* iotype'll be null for the SYS$INPUT:/SYS$OUTPUT:/SYS$ERROR: files */
+      /* since we didn't really open them and can't really */
+      /* reopen them */
+      case 0:                       return NULL;                        break;
       default:
-        warn("Unrecognized iotype %c in my_binmode",iotype);
+        warn("Unrecognized iotype %x for %s in my_binmode",iotype, filespec);
         acmode = "rb+";
     }
     if (freopen(filespec,acmode,fp) == NULL) return NULL;