From owner-freebsd-bugs@FreeBSD.ORG Sat Nov 21 10:00:16 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA2AA1065676 for ; Sat, 21 Nov 2009 10:00:16 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 2BBAE8FC15 for ; Sat, 21 Nov 2009 10:00:09 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nALA084D032037 for ; Sat, 21 Nov 2009 10:00:08 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id nALA08Lf032036; Sat, 21 Nov 2009 10:00:08 GMT (envelope-from gnats) Date: Sat, 21 Nov 2009 10:00:08 GMT Message-Id: <200911211000.nALA08Lf032036@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Bruce Evans Cc: Subject: Re: kern/140690: [libc] [patch] swab(3) with negative len should do nothing X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Bruce Evans List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Nov 2009 10:00:16 -0000 The following reply was made to PR kern/140690; it has been noted by GNATS. From: Bruce Evans To: Paul Procacci Cc: bug-followup@freebsd.org Subject: Re: kern/140690: [libc] [patch] swab(3) with negative len should do nothing Date: Sat, 21 Nov 2009 20:59:35 +1100 (EST) On Sat, 21 Nov 2009, Paul Procacci wrote: > I'd like to add to this. > > As for the length argument. Is there really ever a time it would have > to be signed? > > If not, then I would suggest declaring the type as size_t and not > ssize_t much like the read/write/etc syscalls. The type should be unsigned (size_t), and was unsigned (size_t) in BSD, but it is broken in POSIX (ssize_t), and FreeBSD changed the API to be not even bug for bug compatible with POSIX in 2004 (since POSIX requires nothing to be done when the length is negative, like the patch in the PR implements). The type was implicit int in V7, but BSD changed it to size_t in Net/2 or earlier; thus the type and the the code were correct in all versions of FreeBSD between 1993 and 2004. Bruce