> From: Jacek Prucia [mailto:[EMAIL PROTECTED]
> Sent: Monday, September 08, 2003 2:41 AM

> On Sun, 7 Sep 2003 20:06:09 -0400 (EDT)
> Cliff Woolley <[EMAIL PROTECTED]> wrote:
> 
> > On Sun, 7 Sep 2003 [EMAIL PROTECTED] wrote:
> > 
> > >   +        if (apr_procattr_create(&procattr, rp->pool) != APR_SUCCESS) {
> > >   +            apr_file_printf(local_stderr,
> > >   +                            "apr_procattr_create failed for '%s'\n",
> > >   +                            rp->url[rp->current_url].responsescript);
> > >   +            return APR_EGENERAL;
> > >   +        }
> > 
> > Why do all of these return APR_EGENERAL rather than catching the
> > apr_status_t from the function that was called (apr_procattr_create in
> > this case) and returning that?  Is this just a flood thing I don't know
> > about?
> 
> Nope. I'm not so familliar with APR, so a message to stderr plus APR_EGENERAL
> is a safe bet. If this looks really obscure considering APR concepts, then
> please feel free to commit a fix.

Basically do something like this:

  apr_status_t rv;
  ...

  rv = apr_procattr_create(&procattr, rp->pool);
  if (rv) { /* Or in full: if (rv != APR_SUCCESS) */
      apr_file_printf(local_stderr,
                      "apr_procattr_create failed for '%s'\n",
                      rp->url[rp->current_url].responsescript);
      return rv;
  }

IOW, preserve the error and pass it down back the calling chain.


Sander

Reply via email to