From owner-svn-src-all@freebsd.org Mon Feb 15 21:12:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E8D8AA9994 for ; Mon, 15 Feb 2016 21:12:36 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm11-vm1.bullet.mail.bf1.yahoo.com (nm11-vm1.bullet.mail.bf1.yahoo.com [98.139.213.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BCA8214B7 for ; Mon, 15 Feb 2016 21:12:35 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1455570748; bh=QNDqizuqWmfPue+2SlIM7nhJOXqhM14KvUEf7wZ2ayo=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=geJQNDZI33cgu1Hdc/oygOV0CoGFQUjszNQ0efeTZozTtFyuCKXtWd3YFo6FnXDAGLm/rMFUqZbQYPPPLVh28SJohioeuCLXS9iCOuCErUZKgi8x8D4mYpPYtPIVtk10n2HswJg1VOtjQsECY0lbTGdO/3Ll7qtWoE8DVebd7a9gwD8cPb22MX/kzTDZsSUfRs+ypbiDJhz1tMcyLSuMGcHVTabE4ya4Lj9bGw/jHnuTK9ms7VwW0M55u7+hEbrJcN/8sU5DBPQ/AotkRUOrXRX/FuDvjpUk46+swP341Cc+/BE0IEy6X3AJYk/HH/kzJXTI4DBPKGTORFy4VuSy8w== Received: from [66.196.81.171] by nm11.bullet.mail.bf1.yahoo.com with NNFMP; 15 Feb 2016 21:12:28 -0000 Received: from [98.139.213.10] by tm17.bullet.mail.bf1.yahoo.com with NNFMP; 15 Feb 2016 21:12:28 -0000 Received: from [127.0.0.1] by smtp110.mail.bf1.yahoo.com with NNFMP; 15 Feb 2016 21:12:28 -0000 X-Yahoo-Newman-Id: 825340.12946.bm@smtp110.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: aa5ucRYVM1lYluJeJI9BV6lp4IxQNXwtcz3gw.jQjpb6dat 0OW2hX4eGLrgom_0.q8Ll8o2xagzj.0F8xiEQT1tkMlYdZDXD_U47FCOv9TZ .CMOQN4S8UvAlS1KTmMR8F9qdaxp47ZJLxXmOQ0Ta7dflG2RyAU2dgJS0oZ5 A.Jf3M0nIe7e7bBxdK4hy.jj4SbSSasEf8FclHrRfeKHs2H2_2GShiJNh95y Vpn87cqsVTQEqvaRGXLy3rFIczop4ZfJiCbVSDuDkTgztKGbyHZuheR5PCyi E0fDFk8Hc67a47a7CkX0zdFNfhknDElFipqLaDl_OUsXY8dcU5ncYn35AfTZ 8Q9f.BtWECUz0gp1t0rMTI5jpuutf1hyTzHmTZRNZvG50UXcxtNoCJjm_ifP kPbzo4xp0YicfhU0yTLaM7GwKFbZ08ZdBa6SCDujBigzIvDnkBy67fZarZX1 SSh1oC8MSkAPENwtBofhqSJ2LX3p00JGjELAaTYFEiULMT0HDvIr0Ph8WWLM Jxjb_8I_qeq8ciU.nuA5U9ZWH.dhWPLKu X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r295631 - head/lib/libc/stdio To: Bruce Evans References: <201602151813.u1FIDXAt067326@repo.freebsd.org> <20160216073421.B1073@besplex.bde.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Pedro Giffuni Message-ID: <56C23F51.2070401@FreeBSD.org> Date: Mon, 15 Feb 2016 16:12:49 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <20160216073421.B1073@besplex.bde.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2016 21:12:36 -0000 On 02/15/16 15:48, Bruce Evans wrote: > On Mon, 15 Feb 2016, Pedro F. Giffuni wrote: > >> Log: >> fputs: Return the number of bytes written. >> >> POSIX.1-2008 requires that successful completion simply return a >> non-negative integer. We have regularly returned a constant value. >> Another, equally valid, implementation convention implies returning >> the number of bytes written. >> >> Adopt this last convention to be in line with what Apple's libc >> does. POSIX also explicitly notes: >> >> Note that this implementation convention cannot be adhered to for >> strings >> longer than {INT_MAX} bytes as the value would not be representable >> in the >> return type of the function. For backwards-compatibility, >> implementations >> can return the number of bytes for strings of up to {INT_MAX} bytes, and >> return {INT_MAX} for all longer strings. >> >> Developers shouldn't depend specifically on either convention but >> the change may help port software from Apple. >> >> Differential Revision: https://reviews.freebsd.org/D442 (Partial) >> Obtained from: Apple Inc. (Libc 997.90.3 with changes) >> Relnotes: yes >> >> Modified: >> head/lib/libc/stdio/fputs.c >> >> Modified: head/lib/libc/stdio/fputs.c >> ============================================================================== >> >> --- head/lib/libc/stdio/fputs.c Mon Feb 15 17:14:10 2016 (r295630) >> +++ head/lib/libc/stdio/fputs.c Mon Feb 15 18:13:33 2016 (r295631) >> @@ -37,6 +37,7 @@ static char sccsid[] = "@(#)fputs.c 8.1 >> __FBSDID("$FreeBSD$"); >> >> #include "namespace.h" >> +#include >> #include >> #include >> #include "un-namespace.h" >> @@ -62,5 +63,7 @@ fputs(const char * __restrict s, FILE * >> ORIENT(fp, -1); >> retval = __sfvwrite(fp, &uio); >> FUNLOCKFILE(fp); >> + if (retval == 0) >> + return (iov.iov_len > INT_MAX ? INT_MAX : uio.uio_resid); >> return (retval); >> } > > Testing would have shown that this change has no effect except in the > unusual case where iov.iov_len > INT_MAX. uio.resid is always reduced > to 0 if all the output actually worked. > My mistake, obviously. It was a last minute change to avoid a cast. Will fix. Thanks! Pedro. > Bruce