apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: What was lost in apmail tmp/ full ...
Date Sat, 14 Dec 2002 07:38:22 GMT
At 01:21 AM 12/14/2002, William A. Rowe, Jr. wrote:
>--- file_io/unix/dir.c  1 Jul 2002 14:04:58 -0000       1.64
>+++ file_io/unix/dir.c  14 Dec 2002 05:55:03 -0000      1.65
...
>         ret = apr_lstat(finfo, fspec, wanted, thedir->pool);
>...
>     }
> 
>     if (wanted && (ret == APR_SUCCESS || ret == APR_INCOMPLETE)) {
>         wanted &= ~finfo->valid;
>-        ret = APR_SUCCESS;
>     }

This little bit above was a bug... if a given platform didn't support a given 
field from wanted... APR_INCOMPLETE remains the correct result code.
Not that it matters because we didn't look at ret again.

>+    finfo->name = apr_pstrdup(thedir->pool, thedir->entry->d_name);
>     finfo->valid |= APR_FINFO_NAME;
>-    /* XXX: Optimize here with d_fileno, d_type etc by platform */
>-    finfo->name = thedir->entry->d_name;

This too was a bug... we must pstrdup since one apr_dir_read later
we've clobbered finfo->name.  No other API makes things 'disappear'
behind another access.  The pool scope is all that matters, until
it falls out of scope, any string we return should remain available.

With the introduction of DIRENT_TYPE and DIRENT_INODE I stand
prepared to deal with platform bogosity.  If it doesn't pick these up
correctly on your platform please let me know.

Bill


Mime
View raw message