From owner-freebsd-bugs@FreeBSD.ORG Tue Dec 16 13:10:22 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 68B2E16A4CE for ; Tue, 16 Dec 2003 13:10:22 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id B541F43D49 for ; Tue, 16 Dec 2003 13:10:17 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) hBGLAHFR073173 for ; Tue, 16 Dec 2003 13:10:17 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id hBGLAHuV073172; Tue, 16 Dec 2003 13:10:17 -0800 (PST) (envelope-from gnats) Resent-Date: Tue, 16 Dec 2003 13:10:17 -0800 (PST) Resent-Message-Id: <200312162110.hBGLAHuV073172@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Jeff King Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BC13316A4CE for ; Tue, 16 Dec 2003 13:02:58 -0800 (PST) Received: from peff.net (adsl-068-209-112-235.sip.asm.bellsouth.net [68.209.112.235]) by mx1.FreeBSD.org (Postfix) with ESMTP id 59D6343D45 for ; Tue, 16 Dec 2003 13:02:57 -0800 (PST) (envelope-from peff@peff.net) Received: (qmail 23817 invoked by uid 1001); 16 Dec 2003 21:03:19 -0000 Message-Id: <20031216210319.23816.qmail@peff.net> Date: 16 Dec 2003 21:03:19 -0000 From: Jeff King To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: misc/60309: sys/socket.h: CMSG_NXTHDR requires definition of NULL X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Jeff King List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Dec 2003 21:10:22 -0000 >Number: 60309 >Category: misc >Synopsis: sys/socket.h: CMSG_NXTHDR requires definition of NULL >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Dec 16 13:10:17 PST 2003 >Closed-Date: >Last-Modified: >Originator: Jeff King >Release: FreeBSD 5.1-RELEASE-p10 i386 >Organization: >Environment: System: FreeBSD segfault.peff.net 5.1-RELEASE-p10 FreeBSD 5.1-RELEASE-p10 #2: Fri Oct 10 04:15:30 EDT 2003 root@segfault.peff.net:/usr/obj/usr/src/sys/SEGFAULT i386 >Description: The definition of CMSG_NXTHDR in /usr/include/sys/socket.h references 'NULL' but does not take any steps to define it. This causes broken compilation for programs (that used to work). I'm not sure when the breakage occurred...it happens on my 5.1-RELEASE-p10, but also on 4.9. It was not a problem for me about six months ago, on I think 4.7. Unfortunately, I'm having a hard time tracking down the exact change, since it may well be from a recursive include. >How-To-Repeat: Compiling the following C file triggers the problem: #include #include void foo(struct msghdr *msg) { struct cmsghdr* cmsg; for(cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) ; } >Fix: The possibilities are thus: - one line patch to change NULL to 0 in sys/socket.h - define NULL either manually (wrapped in indef NULL) or by including unistd/stdlib (and getting a bunch of other cruft). - accepting that users must include unistd.h or similar before using the macro. In this case, I think that the relevant man page (recv(2)?) should mention this. However, I prefer not introducing this dependency. >Release-Note: >Audit-Trail: >Unformatted: