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: apr_stat / apr_file_info_get misbehaving?
Date Wed, 17 May 2006 00:08:13 GMT
Tyler MacDonald wrote:
> I'm getting this output:
> 
> APR: file is 0 bytes
> stat: file is 21296 bytes
> 
> From this code:
> 
>     bzero(&finfo, sizeof(finfo));
>     bzero(&sinfo, sizeof(sinfo));

First, assure us finfo is an apr_fileinfo_t and not a unixish finfo_t?

>     if((rv = apr_stat(&finfo, path, APR_FINFO_NORM, p)) != APR_SUCCESS) {
>         fprintf(stderr, "Failed to retrieve file information for %s\n", path);
>         return NULL;
>     }
> 
>     printf("APR: file is %lu bytes\n", finfo.size);

You might be interested in APR_OFF_T_FMT (I think that's the name)

Are you sure apr_off_t fits in %lu in your ./configure'ation?

> Even if I change APR_FINFO_NORM to APR_FINFO_SIZE, or even open the file
> first and use apr_file_info_get, APR always returns "size" as zero. Does
> anybody know what could cause this?

Uhm - need to tell us if finfo.valid & APR_FINFO_SIZE is set or not.

_NORM includes _SIZE fwiw.

Bill

Mime
View raw message