Daniel Shahaf <danie...@elego.de> writes:

> +static apr_status_t
> +close_stream_cleanup(void *stream)
> +{
> +  apr_status_t apr_err = APR_SUCCESS;
> +  svn_error_t *err;
> +  
> +  err = svn_stream_close(stream);
> +  if (err)
> +    {
> +      apr_err = err->apr_err;
> +      svn_error_clear(err);
> +    }
> +
> +  return apr_err;
> +}
> +
>  svn_stream_t *
>  svn_stream_create(void *baton, apr_pool_t *pool)
>  {
> @@ -73,6 +89,9 @@ svn_stream_create(void *baton, apr_pool_t *pool)
>    stream->mark_fn = NULL;
>    stream->seek_fn = NULL;
>    stream->buffered_fn = NULL;
> +  apr_pool_cleanup_register(pool, stream,
> +                            close_stream_cleanup,
> +                            apr_pool_cleanup_null);
>    return stream;
>  }

What happens to streams that are explicitly closed?  When the pool
cleanup handler runs it will close the stream a second time.

-- 
Philip

Reply via email to