Optional warning for truncated logical name equivalence string (Dan Sugalski)
Charles Bailey [Thu, 2 Mar 2000 04:06:53 +0000 (04:06 +0000)]
p4raw-id: //depot/vmsperl@5428

vms/vms.c

index 16c226a..1aa7a32 100644 (file)
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -616,6 +616,12 @@ vmssetenv(char *lnm, char *eqv, struct dsc$descriptor_s **tabvec)
         }
         else {
           if (!*eqv) eqvdsc.dsc$w_length = 1;
+         if (eqvdsc.dsc$w_length > LNM$C_NAMLENGTH) {
+           eqvdsc.dsc$w_length = LNM$C_NAMLENGTH;
+           if (ckWARN(WARN_MISC)) {
+             Perl_warner(aTHX_ WARN_MISC,"Value of logical \"%s\" too long. Truncating to %i bytes",lnm, LNM$C_NAMLENGTH);
+           }
+         }
           retsts = lib$set_logical(&lnmdsc,&eqvdsc,tabvec[0],0,0);
         }
       }