From owner-freebsd-current Sun Nov 22 07:43:31 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA17153 for freebsd-current-outgoing; Sun, 22 Nov 1998 07:43:31 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from gatekeeper.tsc.tdk.com (gatekeeper.tsc.tdk.com [207.113.159.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA17147 for ; Sun, 22 Nov 1998 07:43:30 -0800 (PST) (envelope-from gdonl@tsc.tdk.com) Received: from sunrise.gv.tsc.tdk.com (root@sunrise.gv.tsc.tdk.com [192.168.241.191]) by gatekeeper.tsc.tdk.com (8.8.8/8.8.8) with ESMTP id HAA27909; Sun, 22 Nov 1998 07:42:56 -0800 (PST) (envelope-from gdonl@tsc.tdk.com) Received: from salsa.gv.tsc.tdk.com (salsa.gv.tsc.tdk.com [192.168.241.194]) by sunrise.gv.tsc.tdk.com (8.8.5/8.8.5) with ESMTP id HAA04166; Sun, 22 Nov 1998 07:42:54 -0800 (PST) Received: (from gdonl@localhost) by salsa.gv.tsc.tdk.com (8.8.5/8.8.5) id HAA01025; Sun, 22 Nov 1998 07:42:53 -0800 (PST) From: Don Lewis Message-Id: <199811221542.HAA01025@salsa.gv.tsc.tdk.com> Date: Sun, 22 Nov 1998 07:42:53 -0800 In-Reply-To: "David O'Brien" "Re: snprintf() in the kernel" (Nov 19, 8:30pm) X-Mailer: Mail User's Shell (7.2.6 alpha(3) 7/19/95) To: obrien@NUXI.com, Archie Cobbs Subject: Re: snprintf() in the kernel Cc: freebsd-current@FreeBSD.ORG Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Nov 19, 8:30pm, "David O'Brien" wrote: } Subject: Re: snprintf() in the kernel } > The only subtle gotcha with snprintf() is that it returns } > the number of characters that *would* have been printed, } > not the number that actually were printed. } } So, create a new function called ksprintf() that has the calling semantics } of sprintf(), but the return semantics you like. I think the correct thing to do in many cases is to trap this and return the appropriate error. Silent truncation may introduce other bugs. --- Truck To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message