You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Karl Fogel <kf...@newton.ch.collab.net> on 2002/07/18 23:20:58 UTC
EINVAL vs APR_EINVAL in apr_xlate_open()
Is there any reason to prefer EINVAL to APR_EINVAL, or vice versa, in
apr_xlate_open()? I was just about to go document this case in
apr-util/include/apr_xlate.h, when the question occurred to me...
apr-util/xlate/xlate.c
revision 1.4
date: 2002/07/18 00:12:13; author: gstein; state: Exp; lines: +19 -4
Fix some error handling for platforms with a broken iconv(). In
certain cases, iconv will return -1 to indicate an error, but it won't
set the errno variable. Return EINVAL in these cases.
Thanks,
-K
Re: EINVAL vs APR_EINVAL in apr_xlate_open()
Posted by Justin Erenkrantz <je...@apache.org>.
On Thu, Jul 18, 2002 at 05:04:33PM -0500, Karl Fogel wrote:
> Well, this is *us* generating the EINVAL by fiat, not getting it from
> some lower-down system call.
>
> Maybe we should still go with APR_EINVAL, on the principle of least
> surprise, though. I'm not sure; trusting people with more APR
> experience to know a good answer here.
Right, the system is free to use EINVAL. APR should not produce
EINVAL itself.
I'm assuming you mean this code fragment in xlate.c:
return rv ? rv : EINVAL;
By all means that should be:
return rv ? rv : APR_EINVAL;
HTH. -- justin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: EINVAL vs APR_EINVAL in apr_xlate_open()
Posted by Justin Erenkrantz <je...@apache.org>.
On Thu, Jul 18, 2002 at 05:04:33PM -0500, Karl Fogel wrote:
> Well, this is *us* generating the EINVAL by fiat, not getting it from
> some lower-down system call.
>
> Maybe we should still go with APR_EINVAL, on the principle of least
> surprise, though. I'm not sure; trusting people with more APR
> experience to know a good answer here.
Right, the system is free to use EINVAL. APR should not produce
EINVAL itself.
I'm assuming you mean this code fragment in xlate.c:
return rv ? rv : EINVAL;
By all means that should be:
return rv ? rv : APR_EINVAL;
HTH. -- justin
RE: EINVAL vs APR_EINVAL in apr_xlate_open()
Posted by Ryan Bloom <rb...@covalent.net>.
> From: Karl Fogel [mailto:kfogel@newton.ch.collab.net]
>
> Justin Erenkrantz <je...@apache.org> writes:
> > In APR calls, if EINVAL is produced, it should use APR_EINVAL.
> >
> > And, for checking for error, the caller should use
> > APR_STATUS_IS_EINVAL(s). -- justin
>
> Well, this is *us* generating the EINVAL by fiat, not getting it from
> some lower-down system call.
>
> Maybe we should still go with APR_EINVAL, on the principle of least
> surprise, though. I'm not sure; trusting people with more APR
> experience to know a good answer here.
Just for completeness. We should be returning APR_EINVAL, because that
is the safe code. However, on all platforms that implement EINVAL,
EINVAL and APR_EINVAL are equivalent. And, I can't think of any
platforms that don't define EINVAL.
Ryan
RE: EINVAL vs APR_EINVAL in apr_xlate_open()
Posted by Ryan Bloom <rb...@covalent.net>.
> From: Karl Fogel [mailto:kfogel@newton.ch.collab.net]
>
> Justin Erenkrantz <je...@apache.org> writes:
> > In APR calls, if EINVAL is produced, it should use APR_EINVAL.
> >
> > And, for checking for error, the caller should use
> > APR_STATUS_IS_EINVAL(s). -- justin
>
> Well, this is *us* generating the EINVAL by fiat, not getting it from
> some lower-down system call.
>
> Maybe we should still go with APR_EINVAL, on the principle of least
> surprise, though. I'm not sure; trusting people with more APR
> experience to know a good answer here.
Just for completeness. We should be returning APR_EINVAL, because that
is the safe code. However, on all platforms that implement EINVAL,
EINVAL and APR_EINVAL are equivalent. And, I can't think of any
platforms that don't define EINVAL.
Ryan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: EINVAL vs APR_EINVAL in apr_xlate_open()
Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Justin Erenkrantz <je...@apache.org> writes:
> In APR calls, if EINVAL is produced, it should use APR_EINVAL.
>
> And, for checking for error, the caller should use
> APR_STATUS_IS_EINVAL(s). -- justin
Well, this is *us* generating the EINVAL by fiat, not getting it from
some lower-down system call.
Maybe we should still go with APR_EINVAL, on the principle of least
surprise, though. I'm not sure; trusting people with more APR
experience to know a good answer here.
Re: EINVAL vs APR_EINVAL in apr_xlate_open()
Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Justin Erenkrantz <je...@apache.org> writes:
> In APR calls, if EINVAL is produced, it should use APR_EINVAL.
>
> And, for checking for error, the caller should use
> APR_STATUS_IS_EINVAL(s). -- justin
Well, this is *us* generating the EINVAL by fiat, not getting it from
some lower-down system call.
Maybe we should still go with APR_EINVAL, on the principle of least
surprise, though. I'm not sure; trusting people with more APR
experience to know a good answer here.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: EINVAL vs APR_EINVAL in apr_xlate_open()
Posted by Justin Erenkrantz <je...@apache.org>.
On Thu, Jul 18, 2002 at 04:20:58PM -0500, Karl Fogel wrote:
> Is there any reason to prefer EINVAL to APR_EINVAL, or vice versa, in
> apr_xlate_open()? I was just about to go document this case in
> apr-util/include/apr_xlate.h, when the question occurred to me...
In APR calls, if EINVAL is produced, it should use APR_EINVAL.
And, for checking for error, the caller should use
APR_STATUS_IS_EINVAL(s). -- justin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: EINVAL vs APR_EINVAL in apr_xlate_open()
Posted by Justin Erenkrantz <je...@apache.org>.
On Thu, Jul 18, 2002 at 04:20:58PM -0500, Karl Fogel wrote:
> Is there any reason to prefer EINVAL to APR_EINVAL, or vice versa, in
> apr_xlate_open()? I was just about to go document this case in
> apr-util/include/apr_xlate.h, when the question occurred to me...
In APR calls, if EINVAL is produced, it should use APR_EINVAL.
And, for checking for error, the caller should use
APR_STATUS_IS_EINVAL(s). -- justin