From owner-cvs-all Thu May 31 12:45:45 2001 Delivered-To: cvs-all@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.22.40]) by hub.freebsd.org (Postfix) with ESMTP id 4299837B423; Thu, 31 May 2001 12:45:38 -0700 (PDT) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.11.3/8.11.3) with ESMTP id f4VJjTD51968; Thu, 31 May 2001 15:45:29 -0400 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <20010531115418.B96927@xor.obsecurity.org> References: <200105252042.f4PKgfu84635@freefall.freebsd.org> <20010526004601.2109A3E2F@bazooka.unixfreak.org> <20010530172131.A60056@FreeBSD.org> <20010530182822.A79068@xor.obsecurity.org> <200105311537.LAA23815@khavrinen.lcs.mit.edu> <20010531115418.B96927@xor.obsecurity.org> Date: Thu, 31 May 2001 15:45:27 -0400 To: Kris Kennaway , Garrett Wollman From: Garance A Drosihn Subject: Re: cvs commit: src/lib/libc/gen setproctitle.3 syslog.3 src/lib/libc/stdio printf.3 Cc: Kris Kennaway , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG At 11:54 AM -0700 5/31/01, Kris Kennaway wrote: >On Thu, May 31, 2001 at 11:37:31AM -0400, Garrett Wollman wrote: > > < said: > > >> > things like how to use strncpy() properly >> > > Mostly, ``don't.'' In almost every case where you think you > > might want to use strncpy(), strncat() is -- despite its > > name -- the correct function to use. > >Not Helpful. > >People use the function and will do so forever, so we should >explain how to use it correctly. Yes, it is helpful. Any system which has strncpy will also have strncat. It IS true that strncpy is pretty much never doing what people THINK it is doing. It IS helpful to point that out to people. Point it out explicitly. They can still use it, for the 1% of cases where what it does is what they do in fact want to happen. However, for most situations the HELPFUL AND CORRECT advice is to recommend that people to use one of strncat or strlcpy/strlcat. Garrett said: Mostly, ``don't.'' And any attempt to write helpful advice should MOSTLY say that "this isn't really the routine you're looking for". -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message