On Mon, 24 Jul 2000, Eric Cholet wrote:
> Hi,
>
> I want to fix this bug in r->filename. Currently it does this:
>
> CODE:
> get_set_PVp(r->filename,r->pool);
> #ifndef WIN32
> if(items > 1)
> stat(r->filename, &r->finfo);
> #endif
>
> The return code for stat() is not checked, therefore the stat
> cache is left at its previous value which doesn't seem right.
> What I want to do is this:
> CODE:
> get_set_PVp(r->filename,r->pool);
> #ifndef WIN32
> if(items > 1)
> - stat(r->filename, &r->finfo);
> + laststatval = stat(r->filename, &r->finfo);
> #endif
missing one piece from roger's patch, something like so:
if ((laststatval = stat(...)) < 0) {
r->finfo.st_mode = 0;
}
> What bothers me is this code in r->finfo:
>
> CODE:
> statcache = r->finfo;
> if (r->finfo.st_mode) {
> laststatval = 0;
> }
> else {
> laststatval = -1;
> }
>
> Why is it checking st_mode instead of laststatval ? That seems wrong,
> if the last stat() returned -1 then r->finfo.st_mode shouldn't be
> trusted, no?
$r->finfo shouldn't check laststatval, Apache did the stat() for
&r->finfo, which doesn not know about PL_laststatval. r->finfo.st_mode
should always be 0 if the stat() of r->filename failed, see
http_request.c:
/* must set this to zero, some stat()s may have corrupted it
* even if they returned an error.
*/
r->finfo.st_mode = 0;
and http_core.c tests that value:
if (r->finfo.st_mode == 0 || (r->path_info && *r->path_info)) {
ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, r,
"File does not exist: %s",r->path_info ?
ap_pstrcat(r->pool, r->filename, r->path_info, NULL)
: r->filename);
return HTTP_NOT_FOUND;
}
i think we're ok to use that test for $r->finfo
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]