From owner-freebsd-stable Tue Oct 16 11:18: 9 2001 Delivered-To: freebsd-stable@freebsd.org Received: from tensor.xs4all.nl (tensor.xs4all.nl [213.84.53.200]) by hub.freebsd.org (Postfix) with ESMTP id A451137B410 for ; Tue, 16 Oct 2001 11:18:03 -0700 (PDT) Received: from matrix.xs4all.nl (matrix.xs4all.nl [192.168.1.2]) by tensor.xs4all.nl (Postfix) with ESMTP id BA24C3E3C; Tue, 16 Oct 2001 20:18:01 +0200 (CEST) Date: Tue, 16 Oct 2001 20:17:51 +0200 From: Dimitry Andric X-Mailer: The Bat! (v1.54/10) Business Reply-To: Dimitry Andric X-Priority: 3 (Normal) Message-ID: <441356059.20011016201751@xs4all.nl> To: Nate Williams Cc: freebsd-stable@FreeBSD.ORG Subject: Re[2]: setenv() cores with NULL value [was Re: Gdm proplem on 4.4] In-Reply-To: <15308.25432.608079.646993@nomad.yogotech.com> References: <200110160353.f9G3rO728525@harmony.village.org> <20011016013834.E293@blossom.cjclark.org> <200110161002.f9GA2CA08544@shalimar.net.au> <15308.25432.608079.646993@nomad.yogotech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2001-10-16 at 18:42:00 Nate Williams wrote: NW> printf("%s", ""); NW> printf("%s", NULL); NW> The first will work, the second will dump core. Nope, it will print the string "(null)", as you can see in /usr/src/lib/libc/stdio/vfprintf.c, around line 673: case 's': if ((cp = GETARG(char *)) == NULL) cp = "(null)"; Almost any printf I've ever seen does the same. 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. :) Cheers, - -- Dimitry Andric PGP Key: http://www.xs4all.nl/~dim/dim.asc Fingerprint: 7AB462D2CE35FC6D42394FCDB05EA30A2E2096A3 Lbh ner abj va ivbyngvba bs gur QZPN -----BEGIN PGP SIGNATURE----- Version: PGP 6.5i Comment: http://www.gn.apc.org/duncan/stoa_cover.htm iQA/AwUBO8xrx7BeowouIJajEQIrFwCfQnJEELGsIw9zF++tv/DKgC8JW4EAoPFP TyJjYSqpdpVB0khqRekaywgq =FjNP -----END PGP SIGNATURE----- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message