From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 17520 invoked from network); 23 Jul 2022 02:09:59 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 23 Jul 2022 02:09:59 -0000 Received: (qmail 16292 invoked by uid 550); 23 Jul 2022 02:09:56 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 16257 invoked from network); 23 Jul 2022 02:09:55 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1658542184; bh=V/9IMZ30I/2zL1EjbX3eVtolF/hDaX5KTLEGcQ1oLoc=; h=Subject:From:To:Date:From; b=CyfaW/Rmh/9HRBzvlj3JUSMIOtCWZWBfl48IijOgImsLWEL9ZABklF86vALP/O9qU 7xdRDWU3Ef3SDVKBVsSOum3kkC99z+X91h39cu2HWV20iQ7kVx51PEyZJYe+s2TteQ 3POfkMjQKnHkaGInOYkQRryES1ytfg8cZ4g9ZV9vs+2gPudM2O2YglCP9pHXy8Khs2 GkkuDcBJ+IoOMdbpNQ/q4nugAORxSvH0tZg0u2/9/CHqUosKsmF5EPywfnUFAWM5cA u91nphR6cFO4ZLoeXpJKREuD57fKqt6HihALdPfLvAxLeTiIKwjSGy6cpb7N/6Qfyp pUi9J3IVbewPw== Message-ID: From: John Scott To: musl@lists.openwall.com Date: Sat, 23 Jul 2022 02:09:25 +0000 Jabber-ID: pert@member.fsf.org Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-gICDC5bkTZi+FiaOy8BH" MIME-Version: 1.0 Subject: [musl] Feature request: strftime() should set errno on failure --=-gICDC5bkTZi+FiaOy8BH Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, My apologies, I don't have a patch, but I think strftime() should set errno on failure as POSIX Issue 8 stipulates: https://austingroupbugs.net/view.php?id=3D1386 I think this functionality is valuable enough that I'd really love it to be implemented soon, even if it doesn't make it into the final standard for whatever reason. Right now, when one gets a return value of 0, there is no way to distinguish the buffer being too small from other causes of error, which means there's no way to tell whether a caller should try reallocating with a larger buffer. Since strftime() is not snprintf-like (but perhaps it could be as an extension since passing NULL to strftime is undefined, not that I'm actually recommending that), there's no way to know how big of a buffer is big enough. Indeed, it's not even clear if NL_TEXTMAX applies here. Setting errno to ERANGE would let the caller know whether a larger buffer should be tried or if the effort will fruitlessly allocate large amounts of memory. Thank you. --=-gICDC5bkTZi+FiaOy8BH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- iIgEABYIADAWIQSiPzylvTnZ6xisfzWz9N0oYfTNugUCYttYVhIcanNjb3R0QHBv c3Rlby5uZXQACgkQs/TdKGH0zboSvgD9GCXEAkZ+JfZuboGvRDfch2X0CIdFekFO 4hMOJtFXlwEBANvRxFE3Mjm7g7u71X7k9yeHoyOrfKwZ9WbMLF0PaOYD =PkPS -----END PGP SIGNATURE----- --=-gICDC5bkTZi+FiaOy8BH--