From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10324 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: strftime sets errno to 22 Date: Sat, 23 Jul 2016 21:47:41 -0400 Message-ID: <20160724014740.GM15995@brightrain.aerifal.cx> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1469324879 4979 80.91.229.3 (24 Jul 2016 01:47:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 24 Jul 2016 01:47:59 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-10337-gllmg-musl=m.gmane.org@lists.openwall.com Sun Jul 24 03:47:59 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1bR8WL-0004pI-Ae for gllmg-musl@m.gmane.org; Sun, 24 Jul 2016 03:47:57 +0200 Original-Received: (qmail 23612 invoked by uid 550); 24 Jul 2016 01:47:55 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 23594 invoked from network); 24 Jul 2016 01:47:54 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:10324 Archived-At: On Sat, Jul 23, 2016 at 10:17:30PM -0300, Alba Pompeo wrote: > Hello musl people. > > I was reading some commits messages from a project and ended up seeing > something that might be interesting to you. > > https://github.com/izabera/inutility/commit/1db3ba948ad1d4cbfa8c0164fa475439c99c06bc > > I don't think it's been reported yet. Except for a few special functions with more restrictive specification, you can only expect errno to contain something meaningful immediately after a function returns with a return value indicating an error. The code above was assuming that errno being set indicated an error even when strftime succeeded. With that said, at the time this was reported on IRC I looked for the cause of errno being set to EINVAL and didn't see it. It might be nice to know why it's happening, just in case some unintended code paths with nontrivial cost are getting pulled in. Rich