Glibc's bindresvport() takes no notice of sin->sin_port:
it always returns an arbitrary reserved port in the
anonymous range (512-1023). (Reported by Mats Wichmann.)
Also:
* Add EADDRINUSE and EACCES errors.
* Mention use of getsockname(2).
* Other minor rewrites and reorderings of the text.
* Explicitly note that glib's bindresvport() ignores
sin->sin_port.
* Change license There's now virtually no text remaining from
the 1.70 version of this page.
Reported-by: Mats Wichmann <mats.d.wichmann@intel.com>
Reviewed-by: Mats Wichmann <mats.d.wichmann@intel.com>
Reviewed-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Clean up the $LANGUAGE description, by removing bogus comments
from setlocale(3) and expanding the mention in locale(7).
Maybe you will decide that a more detailed description should be left
to the gettext(3) documentation, but I actually care about the invisible
part of the patch more since the comments have put me off the track
initially ($LANGUAGE has nothing to do with setlocale(3) and is
completely isolated to gettext, as obvious from the glibc sources).
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
dladdr() will act unexpectedly if called from non-pic code on a
compile-time-generated function pointer:
/* test_dladdr.c */
#define _GNU_SOURCE
#include <dlfcn.h>
#include <stdio.h>
int
main(void)
{
void *func;
Dl_info info = {};
func = printf;
dladdr(func, &info);
printf("%s at %p resolved from %s\n", info.dli_sname,
func, info.dli_fname);
return 0;
}
$ cc test_dladdr.c -ldl
$ ./a.out
printf at 0x804838c resolved from ./a.out
$ cc -fPIC test_dladdr.c -ldl
$ ./a.out
_IO_printf at 0xb7f71c30 resolved from /lib/libc.so.6
In the long term, it might make sense to make dladdr() recognize
plt pointers and recurse, but I'm too afraid of Ulrich ;-)
(and he seems to be heavy proponent of pic code anyway, so
the chances for that to be accepted probably aren't high).
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This patch documents the order of the getaddrinfo(3) results
(RFC 3484), how should the application deal with that,
mentions the extremely common cause of having multiple
results per query (both IPv4 and IPv6 addresses available)
and mentions /etc/gai.conf.
(mtk: Minor tweaks, and note glibc version for /etc/gai.conf)
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
If an exit handler itself calls exit(3), the results are
undefined (see the POSIX.1-2001 specification of exit(3)).
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
According to POSIX.1, using longjmp() to terminate execution of
a function registered using atexit() produces undefined results.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
According to POSIX.1, using longjmp() to terminate execution of
a function registered using atexit() produces undefined results.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
It's a subtle point, but if a registered function itself
calls exit(3), then subsequent functions that were registered
with on_exit(3) will see the exit status given to the more
recent exit(3) call.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>