From owner-freebsd-stable Tue Oct 16 21:48:56 2001 Delivered-To: freebsd-stable@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id ACB9937B403 for ; Tue, 16 Oct 2001 21:48:48 -0700 (PDT) Received: (from dillon@localhost) by apollo.backplane.com (8.11.6/8.9.1) id f9H4mEW94727; Tue, 16 Oct 2001 21:48:14 -0700 (PDT) (envelope-from dillon) Date: Tue, 16 Oct 2001 21:48:14 -0700 (PDT) From: Matthew Dillon Message-Id: <200110170448.f9H4mEW94727@apollo.backplane.com> To: Nate Williams Cc: Dimitry Andric , Nate Williams , freebsd-stable@FreeBSD.ORG Subject: Re: Re[2]: setenv() cores with NULL value [was Re: Gdm proplem on 4.4] References: <200110160353.f9G3rO728525@harmony.village.org> <20011016013834.E293@blossom.cjclark.org> <200110161002.f9GA2CA08544@shalimar.net.au> <15308.25432.608079.646993@nomad.yogotech.com> <441356059.20011016201751@xs4all.nl> <15308.31250.176938.430969@nomad.yogotech.com> Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG :> case 's': :> if ((cp = GETARG(char *)) == NULL) :> cp = "(null)"; :> :> Almost any printf I've ever seen does the same. : :Well, I'll be. :( : :> NW> The second has never worked, and should never work. :> :> That's debatable. In the interest of consistency, it should surely :> coredump, but for the sake of compatibility, it shouldn't. You don't :> want to know how many times I see (null) strings in program messages, :> log files, etc. :) : :Thanks for the clarification! : :Nate It depends how portable you want to be. When I wrote Diablo I had bunches of logging printf's that would pass NULL string pointers. It worked fine on FreeBSD and a couple of other platforms, and not so fine on some (I forget which ones). So for portability I had to adjust the code to ensure that a NULL pointer would never be passed as a string. -Matt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message