You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Scott Greig <sg...@altair.com> on 2004/09/20 18:53:33 UTC
Bug in unix apr_stat involving the name field.
The following works on win32 but not on linux. Looks like the name field of
apr_file_t is never set on unix so the value is garbage.
apr_file_t finfo;
apr_status_t s = apr_stat(&finfo, filename,
APR_FINFO_NAME |
APR_FINFO_SIZE,
pool);
if (s == APR_SUCCESS)
{
std::cout << "Path+Name: " << finfo.fname << std::endl;
std::cout << "Name: " << finfo.name << std::endl;
std::cout << "Size: " << finfo.size << std::endl;
}
I'm using apr-1.0.0
Thanks,
Scott Greig
Altair Engineering, Inc.
Re: Bug in unix apr_stat involving the name field.
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
At 11:53 AM 9/20/2004, you wrote:
>The following works on win32 but not on linux. Looks like the name field of
>apr_file_t is never set on unix so the value is garbage.
are you testing the .valid bit APR_FINFO_FNAME value?
There are scenarios on every platform when specific fields
cannot be set, it's important to check the .valid bits.
If apr_stat(...., APR_FINFO_NAME, poll) returns APR_SUCCESS, that
would be a bug, the correct return code is APR_INCOMPLETE.
It would be -totally- wrong to just stuff the name passed for
Unix, because some Unix file systems, e.g. mounted from Samba,
HFS (Mac OS), and others can return another file from a
non-canonical name.
Bill