From owner-freebsd-hackers Thu Jul 15 15:34: 8 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from smtp13.bellglobal.com (smtp13.bellglobal.com [204.101.251.52]) by hub.freebsd.org (Postfix) with ESMTP id B0BC815616 for ; Thu, 15 Jul 1999 15:34:04 -0700 (PDT) (envelope-from hoek@FreeBSD.org) Received: from localhost.nowhere (ppp18340.on.bellglobal.com [206.172.130.20]) by smtp13.bellglobal.com (8.8.5/8.8.5) with ESMTP id SAA11897; Thu, 15 Jul 1999 18:35:29 -0400 (EDT) Received: (from tim@localhost) by localhost.nowhere (8.9.3/8.9.1) id SAA53768; Thu, 15 Jul 1999 18:34:42 -0400 (EDT) (envelope-from tim) Date: Thu, 15 Jul 1999 18:34:42 -0400 From: Tim Vanderhoek To: Sheldon Hearn Cc: Garance A Drosihn , Paul Hart , freebsd-hackers@FreeBSD.org Subject: Re: OpenBSD's strlcpy(3) and strlcat(3) Message-ID: <19990715183442.A53661@mad> References: <79492.932076931@axl.noc.iafrica.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95i In-Reply-To: <79492.932076931@axl.noc.iafrica.com>; from Sheldon Hearn on Fri, Jul 16, 1999 at 12:15:31AM +0200 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, Jul 16, 1999 at 12:15:31AM +0200, Sheldon Hearn wrote: > > As I understand it, the goal here is to return to the caller the number > of bytes copied (however you represent it), so that the caller can > easily determine whether or not dst is safe for operations demanding a > null-terminated string. [...] > size_t > fooncat(char *s, const char *append, size_t count) > > where the return value is the number of bytes {copied,appended}. Eeks! This will quickly lead to code like if (fooncat(string, append, sizeof(string)) != strlen(append)) ... which is rather evil, given that the second strlen(append) would be completely gratuitous if it weren't for the interface you're suggesting. -- This is my .signature which gets appended to the end of my messages. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message