mailing list of musl libc
 help / color / mirror / code / Atom feed
* gethostbyname and resolv.conf
@ 2014-04-30 16:02 John Mudd
  2014-04-30 16:12 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: John Mudd @ 2014-04-30 16:02 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 988 bytes --]

FYI: Looks like the musl gethostbyname() doesn't use the "search" command
in the resolv.conf file.


$ cat test_gethostbyname.c
#include <stdio.h>
#include <netdb.h>

int main(int argc, char *argv[])
{
    struct hostent *lh = gethostbyname(argv[1]);

    if (lh)
        puts(lh->h_name);
    else
        herror("gethostbyname");

    return 0;
}
$


$ make  test_gethostbyname
gcc     test_gethostbyname.c   -o test_gethostbyname
$ test_gethostbyname lifeline.rx30.com
lifeline.rx30.com
$ test_gethostbyname lifeline
lifeline.rx30.com
$


$ make  test_gethostbyname
musl-gcc -fno-stack-protector    test_gethostbyname.c   -o
test_gethostbyname
$ test_gethostbyname lifeline.rx30.com
lifeline.rx30.com
$ test_gethostbyname lifeline
gethostbyname: Non-recoverable error
$


$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by
resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
search rx30.com
$

[-- Attachment #2: Type: text/html, Size: 1824 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-30 16:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-30 16:02 gethostbyname and resolv.conf John Mudd
2014-04-30 16:12 ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).