Date: Tue, 16 Oct 2001 20:17:51 +0200 From: Dimitry Andric <dim@xs4all.nl> To: Nate Williams <nate@yogotech.com> Cc: freebsd-stable@FreeBSD.ORG Subject: Re[2]: setenv() cores with NULL value [was Re: Gdm proplem on 4.4] Message-ID: <441356059.20011016201751@xs4all.nl> In-Reply-To: <15308.25432.608079.646993@nomad.yogotech.com> References: <200110160353.f9G3rO728525@harmony.village.org> <Pine.LNX.4.33.0110152249220.8479-100000@organ.cs.byu.edu> <20011016013834.E293@blossom.cjclark.org> <200110161002.f9GA2CA08544@shalimar.net.au> <15308.25432.608079.646993@nomad.yogotech.com>
next in thread | previous in thread | raw e-mail | index | archive | help
-----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 <dim@xs4all.nl> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?441356059.20011016201751>