From: John E. Malmberg Date: Tue, 31 Jan 2006 04:37:27 +0000 (+0000) Subject: patch@26996 - patch around stat("_NLA0:") bug X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=682e4b71848152d6896e0c5f2ed3943038c0c77e;p=p5sagit%2Fp5-mst-13.2.git patch@26996 - patch around stat("_NLA0:") bug From: "John E. Malmberg" Date: Mon, 30 Jan 2006 23:21:34 -0500 Message-id: <43DEE5CE.7060108@qsl.net> p4raw-id: //depot/perl@27015 --- diff --git a/vms/vms.c b/vms/vms.c index 6c8208a..14248a6 100644 --- a/vms/vms.c +++ b/vms/vms.c @@ -246,7 +246,7 @@ static int vms_process_case_tolerant = 1; /* bug workarounds if needed */ int decc_bug_readdir_efs1 = 0; -int decc_bug_devnull = 0; +int decc_bug_devnull = 1; int decc_bug_fgetname = 0; int decc_dir_barename = 0; @@ -3127,11 +3127,7 @@ vmspipe_tempfile(pTHX) if (!fp) return 0; fstat(fileno(fp), (struct stat *)&s1); - #if defined(_USE_STD_STAT) - cmp_result = s0.crtl_stat.st_ino != s1.crtl_stat.st_ino; - #else - cmp_result = memcmp(s0.crtl_stat.st_ino, s1.crtl_stat.st_ino, 6); - #endif + cmp_result = VMS_INO_T_COMPARE(s0.crtl_stat.st_ino, s1.crtl_stat.st_ino); if ((cmp_result != 0) && (s0.st_ctime != s1.st_ctime)) { fclose(fp); return 0; @@ -9504,7 +9500,7 @@ is_null_device(name) const char *name; { if (decc_bug_devnull != 0) { - if (strcmp("/dev/null", name) == 0) /* temp hack */ + if (strncmp("/dev/null", name, 9) == 0) return 1; } /* The VMS null device is named "_NLA0:", usually abbreviated as "NL:". @@ -9702,11 +9698,8 @@ Perl_flex_fstat(pTHX_ int fd, Stat_t *statbufp) if (cptr == NULL) namecache[0] = '\0'; } -#ifdef _USE_STD_STAT - memcpy(&statbufp->st_ino, &statbufp->crtl_stat.st_ino, 8); -#else - memcpy(&statbufp->st_ino, statbufp->crtl_stat.st_ino, 8); -#endif + + VMS_INO_T_COPY(statbufp->st_ino, statbufp->crtl_stat.st_ino); #ifndef _USE_STD_STAT strncpy(statbufp->st_devnam, statbufp->crtl_stat.st_dev, 63); statbufp->st_devnam[63] = 0; @@ -9822,11 +9815,7 @@ Perl_flex_stat_int(pTHX_ const char *fspec, Stat_t *statbufp, int lstat_flag) } #endif if (!retval) { -#ifdef _USE_STD_STAT - memcpy(&statbufp->st_ino, &statbufp->crtl_stat.st_ino, 8); -#else - memcpy(&statbufp->st_ino, statbufp->crtl_stat.st_ino, 8); -#endif + VMS_INO_T_COPY(statbufp->st_ino, statbufp->crtl_stat.st_ino); #ifndef _USE_STD_STAT strncpy(statbufp->st_devnam, statbufp->crtl_stat.st_dev, 63); statbufp->st_devnam[63] = 0; @@ -10890,11 +10879,13 @@ static int set_features } /* PCP mode requires creating /dev/null special device file */ - decc_bug_devnull = 0; + decc_bug_devnull = 1; status = sys_trnlnm("DECC_BUG_DEVNULL", val_str, sizeof(val_str)); if ($VMS_STATUS_SUCCESS(status)) { if ((val_str[0] == 'E') || (val_str[0] == '1') || (val_str[0] == 'T')) decc_bug_devnull = 1; + else + decc_bug_devnull = 0; } /* fgetname returning a VMS name in UNIX mode */ diff --git a/vms/vmsish.h b/vms/vmsish.h index 69b4bf1..858024c 100644 --- a/vms/vmsish.h +++ b/vms/vmsish.h @@ -677,7 +677,15 @@ struct mystat #define st_fab_rfm crtl_stat.st_fab_rfm #define st_fab_rat crtl_stat.st_fab_rat #define st_fab_fsz crtl_stat.st_fab_fsz -#define st_fab_mrs crtl_stat_st_fab_mrs +#define st_fab_mrs crtl_stat.st_fab_mrs + +#ifdef _USE_STD_STAT +#define VMS_INO_T_COMPARE(__a, __b) (__a != __b) +#define VMS_INO_T_COPY(__a, __b) a = b +#else +#define VMS_INO_T_COMPARE(__a, __b) memcmp(&__a, &__b, 6) +#define VMS_INO_T_COPY(__a, __b) memcpy(&__a, &__b, 6) +#endif #if defined(__DECC) || defined(__DECCXX) # pragma __member_alignment __restore