In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/a84b1d1f981773674baedc3f054c82b3243c6136?hp=2abb04977db87a1e49b7f84f7caf49109ee47b22>
- Log ----------------------------------------------------------------- commit a84b1d1f981773674baedc3f054c82b3243c6136 Author: Craig A. Berry <[email protected]> Date: Fri Nov 30 21:47:03 2012 -0600 Remove a spurious strlen in VMS's readdir(). After setting the null byte, we turned around and pretended we didn't know where it was and went hunting for it. Hmm. M vms/vms.c commit 66facaa366b2bb9328ac16455b0b17db621a069d Author: Craig A. Berry <[email protected]> Date: Fri Nov 30 21:20:47 2012 -0600 Fix memory leak in VMS's readdir(). When we got to the end of a directory we were not freeing the buffer we'd been using. So refactor that section of code to have only one return. Bug introduced in 657054d4f860463a01c5. M vms/vms.c ----------------------------------------------------------------------- Summary of changes: vms/vms.c | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/vms/vms.c b/vms/vms.c index b847ab0..38c4ff1 100644 --- a/vms/vms.c +++ b/vms/vms.c @@ -10103,20 +10103,23 @@ Perl_readdir(pTHX_ DIR *dd) tmpsts = lib$find_file (&dd->pat, &res, &dd->context, NULL, NULL, &rsts, &flags); - if ( tmpsts == RMS$_NMF || dd->context == 0) return NULL; /* None left. */ + if (dd->context == 0) + tmpsts = RMS$_NMF; /* None left. (should be set, but make sure) */ + if (!(tmpsts & 1)) { - set_vaxc_errno(tmpsts); switch (tmpsts) { + case RMS$_NMF: + break; /* no more files considered success */ case RMS$_PRV: - set_errno(EACCES); break; + SETERRNO(EACCES, tmpsts); break; case RMS$_DEV: - set_errno(ENODEV); break; + SETERRNO(ENODEV, tmpsts); break; case RMS$_DIR: - set_errno(ENOTDIR); break; + SETERRNO(ENOTDIR, tmpsts); break; case RMS$_FNF: case RMS$_DNF: - set_errno(ENOENT); break; + SETERRNO(ENOENT, tmpsts); break; default: - set_errno(EVMSERR); + SETERRNO(EVMSERR, tmpsts); } Safefree(buff); return NULL; @@ -10173,7 +10176,7 @@ Perl_readdir(pTHX_ DIR *dd) memcpy(dd->entry.d_name, n_spec, n_len + e_len); dd->entry.d_name[n_len + e_len] = '\0'; - dd->entry.d_namlen = strlen(dd->entry.d_name); + dd->entry.d_namlen = n_len + e_len; /* Convert the filename to UNIX format if needed */ if (dd->flags & PERL_VMSDIR_M_UNIXSPECS) { -- Perl5 Master Repository
