[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#66769: libc6: gethostbyname() doesn't when linked statically



Package: libc6
Version: 2.1.3-8


Hello,

I have a small test program (see below) that compiles and
works fine using gethostbyname() when using shared libs,
but fails miserably when statically linked.

Sample run:

$  gcc  -g -O2 -o testres testres.c
hostname resolved. hostent at 400f69e4
$ gcc -static -g -O2 -o testres testres.c
$ ./testres 
could not gethostbyname (oak)
: No such file or directory


This is the program in question:

----- 8< snip --------
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
#include <stdio.h>
#include <strings.h>

extern int h_errno;

main () {
        char *s;
        struct hostent *myhostname = NULL;

        myhostname = gethostbyname ("oak");

        if (! myhostname) {
                perror ("could not gethostbyname (oak)\n");
                exit (1);
        } else {
                printf ("hostname resolved. hostent at %08x\n", myhostname);
        }
}

----- >8 snip --------


-- System Information
Debian Release: potato
Kernel Version: Linux oak 2.0.38 #6 Sat Dec 4 16:31:11 CET 1999 i686 unknown

Versions of the packages libc6 depends on:
ii  ldso            1.9.11-5       The Linux dynamic linker, library and utilit



Reply to: