Bug#227386: libc6-dev: ENOTSUP==EOPNOTSUPP, which violates SUSv3
On Tue, Feb 21, 2006 at 06:23:21AM +0000, Brian M. Carlson wrote:
> > (void *)strerror(error_code);
>
> Not thread safe.
Then use strerror_r().
> Also, this code does not check that it is a *POSIX*
> error code. If you check the Linux sources, you can see that there are
> many error codes (mostly for NFS) that are not standard, and therefore
> are invalid for my program.
Let's check. EBADHANDLE is 521 (fwiw, it is not #defined unless
__KERNEL__ is defined, which should not be the case for user-space
programs):
/* We want the SUSv3 version of strerror_r(), not the GNU one */
#define _XOPEN_SOURCE 600
#include <errno.h>
#include <string.h>
#include <stdio.h>
int main(void)
{
errno = 0;
strerror_r(EINVAL, NULL, 0);
printf("%d %s\n", errno, strerror(errno));
errno = 0;
strerror_r(521, NULL, 0);
printf("%d %s\n", errno, strerror(errno));
return 0;
}
This gives:
34 Numerical result out of range
22 Invalid argument
> I have a patch
> forthcoming which mitigates the damage and allows people that really
> want standards compliance to indicate so.
SUSv3 clearly defines how an application should indicate that it
desires standard compliance. By introducing a different schema you are
actually _breaking_ standard compliance here.
Gabor
--
---------------------------------------------------------
MTA SZTAKI Computer and Automation Research Institute
Hungarian Academy of Sciences
---------------------------------------------------------
Reply to: