Avoid freeing literal memory.
[sbcl.git] / tools-for-build / os-provides-getprotoby-r-test.c
blobd1a649ff0a0adfee74ef364afc766d70a4d8f352
1 /* test to build and run so that we know if we have getprotobyname_r
2 * and getprotobynumber_r */
4 #include <netdb.h>
6 #define BUFSIZE 1024
8 int main ()
10 #if __NetBSD__
12 * For me the code below compiles, but it segfaults when actually run:
13 * (gdb) where
14 * #0 0x00007f7fc20050a9 in _rtld_symlook_obj () from /usr/libexec/ld.elf_so
15 * #1 0x00007f7fc20059e0 in _rtld_symlook_default () from /usr/libexec/ld.elf_so
16 * #2 0x00007f7fc20060d3 in _rtld_find_plt_symdef () from /usr/libexec/ld.elf_so
17 * #3 0x00007f7fc2000bc5 in _rtld_bind () from /usr/libexec/ld.elf_so
18 * #4 0x00007f7fc20007fd in _rtld_bind_start () from /usr/libexec/ld.elf_so
19 * #5 0x0000000000000000 in ?? ()
21 * I guess that somebody decided it would be clever to pretend that the calls exist,
22 * but then /usr/libexec/ld.elf_so can't figure out what to do.
24 * This is EXTREMELY disconcerting, as it occurs during 'make-config.sh'
25 * and so you're not sure (without a nontrivial amount of debugging)
26 * whether configuration completed without error.
28 return 1; // just say "no"
29 #else
30 struct protoent result_buf;
31 struct protoent *result;
32 char buf[BUFSIZE];
33 getprotobyname_r("", &result_buf, buf, BUFSIZE, &result);
34 getprotobynumber_r(0, &result_buf, buf, BUFSIZE, &result);
35 return 104;
36 #endif