httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Funk <jasonlf...@gmail.com>
Subject Get filename out of a file bucket
Date Tue, 12 Jul 2011 19:29:17 GMT
This seems like it should be trival but it isn't working for
me. Relevant code snippets:

char * outfn; //apr_palloced later
> ...
> while ((b = APR_BRIGADE_FIRST(bb)) != APR_BRIGADE_SENTINEL(bb)) {
>          bytes=0;
>          if(APR_BUCKET_IS_FILE(b)){ //we should handle file buckets
> specially
>                 rv = apr_file_name_get((const char
> **)&outfn,((apr_bucket_file *)b)->fd);
>                 if (rv != APR_SUCCESS){
>                         //failed
>                         ....
>                 }else{
>                        //success
>                       ....
>                }
>         }else{
>                rv = apr_bucket_read(b, &buf, &bytes, APR_BLOCK_READ);
>          }
>      ...
>  }
>


If I am passed a file bucket, I don't need to read the bucket because the
only reason I'm reading the bucket is to write it to a file anyways so I
just want to switch my outfn from the temporary file I created to the file
buckets filename. I use apr_file_name_get() to get the file name but it's
just returning junk (with APR_SUCCESS return value). Outputting the
resulting file yields "Switching outfn to '0��!���!'"

What am I doing wrong?

Thanks,
Jason

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message