From: Florian Weimer <fw@deneb.enyo.de>
To: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Cc: "devel@uclibc-ng.org" <devel@uclibc-ng.org>,
"jan.vangorp_ext@softathome.com" <jan.vangorp_ext@softathome.com>,
arcml <linux-snps-arc@lists.infradead.org>
Subject: Re: [uclibc-ng-devel] stdio fudging errno ?
Date: Sat, 14 Dec 2019 10:37:08 +0100 [thread overview]
Message-ID: <87k16zdz97.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: <77f8a379-f3dc-6d15-4d8a-20be0346e9f6@synopsys.com> (Vineet Gupta's message of "Thu, 12 Dec 2019 23:54:36 +0000")
* Vineet Gupta:
> Here's a simple test case which shows the problem:
>
> #define _GNU_SOURCE
> #include <stdio.h>
> #include <stdlib.h>
> #include <errno.h>
>
> void main(void)
> {
> const char *this_func = "finite";
> char *test_name;
>
> errno = 0;
> if (asprintf (&test_name, "%s (%s)", this_func, "my-str") == -1)
> abort ();
>
> printf("%d\n", errno); // <-- prints 11
> }
>
> The errno unconditionally being set to EAGAIN seems to have been
> introduced in commit 568ceebf6adfc58c64a95133311268db6 ("Fix
> infinite loop when fopencookie custom write returns 0 on error")
> bakc in 2016.
For functions specified by standards, successful calls can alter errno
unless specified otherwise. asprintf is not a standardized function,
but it is reasonable to expect that a similar rule applies.
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
next prev parent reply other threads:[~2019-12-14 9:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-12 23:54 stdio fudging errno ? Vineet Gupta
2019-12-14 9:37 ` Florian Weimer [this message]
2019-12-16 17:45 ` [uclibc-ng-devel] " Vineet Gupta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k16zdz97.fsf@mid.deneb.enyo.de \
--to=fw@deneb.enyo.de \
--cc=Vineet.Gupta1@synopsys.com \
--cc=devel@uclibc-ng.org \
--cc=jan.vangorp_ext@softathome.com \
--cc=linux-snps-arc@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).