Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Sep 2013 19:29:42 GMT
From:      Jan Beich <jbeich@tormail.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/182466: [patch] make <resolv.h> self-contained
Message-ID:  <201309281929.r8SJTgeW070723@oldred.freebsd.org>
Resent-Message-ID: <201309281930.r8SJU0tN078179@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         182466
>Category:       bin
>Synopsis:       [patch] make <resolv.h> self-contained
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Sep 28 19:30:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Jan Beich
>Release:        FreeBSD 10.0-CURRENT amd64
>Organization:
>Environment:
http://cvsweb.netbsd.org/bsdweb.cgi/src/include/resolv.h.diff?r1=1.39&r2=1.40
https://bug810716.bugzilla.mozilla.org/attachment.cgi?id=808118

>Description:
Our resolv.h already includes a bunch of headers listed in resolver(3)
man page. Make the list complete by adding netinet/in.h for sockaddr_in.

This should reduce patching required when porting code written with
Linux or NetBSD in mind.

reinstating kern/85741

>How-To-Repeat:
$ cat a.c
#include <resolv.h>
int main() { return 0; }

$ cc a.c
In file included from a.c:1:
/usr/include/resolv.h:157:14: error: array has incomplete element type
      'struct sockaddr_in'
                nsaddr_list[MAXNS];     /*%< address of name server */
                           ^
/usr/include/resolv.h:156:9: note: forward declaration of 'struct sockaddr_in'
        struct sockaddr_in
               ^
/usr/include/resolv.h:171:18: error: field has incomplete type 'struct in_addr'
                struct in_addr  addr;
                                ^
/usr/include/resolv.h:171:10: note: forward declaration of 'struct in_addr'
                struct in_addr  addr;
                       ^
/usr/include/resolv.h:195:21: error: field has incomplete type 'struct sockaddr_in'
        struct sockaddr_in      sin;
                                ^
/usr/include/resolv.h:156:9: note: forward declaration of 'struct sockaddr_in'
        struct sockaddr_in
               ^
3 errors generated.

>Fix:
--- res.diff begins here ---
Index: include/resolv.h
===================================================================
--- include/resolv.h	(revision 255808)
+++ include/resolv.h	(working copy)
@@ -58,6 +58,7 @@
 #include <sys/cdefs.h>
 #include <sys/socket.h>
 #include <stdio.h>
+#include <netinet/in.h>
 #include <arpa/nameser.h>
 
 /*%
Index: lib/libc/net/resolver.3
===================================================================
--- lib/libc/net/resolver.3	(revision 255808)
+++ lib/libc/net/resolver.3	(working copy)
@@ -48,9 +48,6 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/types.h
-.In netinet/in.h
-.In arpa/nameser.h
 .In resolv.h
 .Ft int
 .Fo res_query
--- res.diff begins here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309281929.r8SJTgeW070723>