From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1huZ1u-0004iN-Ck for barebox@lists.infradead.org; Mon, 05 Aug 2019 09:11:48 +0000 Date: Mon, 5 Aug 2019 11:11:44 +0200 From: Sascha Hauer Message-ID: <20190805091144.rzos4ebit5q37rz6@pengutronix.de> References: <20190731102143.20503-1-a.fatoum@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190731102143.20503-1-a.fatoum@pengutronix.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH v2 1/3] console: don't count newlines twice in bytes written To: Ahmad Fatoum Cc: barebox@lists.infradead.org On Wed, Jul 31, 2019 at 12:21:41PM +0200, Ahmad Fatoum wrote: > Both the PBL and simple console only return number of input bytes, not > number of bytes actually written out. These differ, because each LF is > converted to CRLF pairs. > > The behavior of not counting actual written out characters is more sensible, > because otherwise callers interested in finding out if all bytes have been > written (e.g. to avoid incomplete writes with ratp) would need to keep count > of all line feeds in the string. > Therefore change the normal console to behave like its less featureful > brethren. According to "man puts" puts() returns a non negative number on success. I can't find a place where it's claimed that we have to return the number of characters. I also can't find a place where the return value of any puts like function in barebox is ever evaluated. Given that it might make more sense to just return zero in the absense of an error. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox