[uClibc]getprotobyname_r patch and glibc differences

Rob McMullen robm at flipturn.org
Sun May 4 14:03:02 UTC 2003


I thought it would be easier to add these to uClibc, rather than
hacking Mozilla.  The getserv*_r functions provided a great template,
so here's a patch that adds:

getprotoent_r
getprotobyname_r
getprotobynumber_r

very much following the style of of getservice.c.  I've included some
tests, (test/inet/* and test/termios/isatty.c) uClibc sets errno to
ENOTTY after all of the get/setproto* and get/setserv* calls while
glibc returns errno==0 from those calls.  I'm guessing most existing
programs don't bother to check for errno, or problems would have
appeared before this...

The problem seems to be in the fopen.  __stdio_fopen always does an
isatty, which when opening /etc/services or /etc/protocols sets errno
to ENOTTY.  So, apparently glibc is resetting it to zero someplace,
but I don't know where the proper place would be in uClibc to reset
the errno to zero.  (I tried following the glibc source to find out
where they do that, but OMG: talk about 'here be dragons...').

Any ideas?

Rob

-------------- next part --------------
A non-text attachment was scrubbed...
Name: uclibc-getproto.patch
Type: application/octet-stream
Size: 16069 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20030504/d0d32f03/attachment.obj 


More information about the uClibc mailing list