public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Hans-Peter Nilsson <hp@axis.com>
To: Torbjorn SVENSSON <torbjorn.svensson@st.com>
Cc: <newlib@sourceware.org>
Subject: Re: [PATCH] Fix stdio init handling
Date: Tue, 7 Jun 2022 16:40:17 +0200	[thread overview]
Message-ID: <20220607144017.E678620419@pchp3.se.axis.com> (raw)
In-Reply-To: <AM6PR10MB2197E7C4551EF2DA1D80A12081A59@AM6PR10MB2197.EURPRD10.PROD.OUTLOOK.COM> (message from Torbjorn SVENSSON on Tue, 7 Jun 2022 08:05:01 +0200)

> From: Torbjorn SVENSSON <torbjorn.svensson@st.com>
> Date: Tue, 7 Jun 2022 08:05:01 +0200


> >   FILE *f = fopen("fff", "r");
> >   int c = fgetc(f);
> > 
> >   if (f == NULL)
> >     {
> >       perror("fopen");
> >       abort();
> >     }
> > 
> 
> Unrelated to the patch proposed, but I think you should
> avoid calling fgetc(f) prior to checking if f is NULL or a
> valid pointer.
> 
> Kind regards,
> Torbjörn

You're absolutely right, and I am fully aware.  I'll
clarify: this was only intended was a quick reproducer of
the problem, not a model program.

brgds, H-P

  reply	other threads:[~2022-06-07 14:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-06 18:20 Hans-Peter Nilsson
2022-06-06 20:16 ` Jeff Johnston
2022-06-07  6:21   ` Sebastian Huber
2022-06-07 14:47     ` Jeff Johnston
2022-06-07  6:05 ` Torbjorn SVENSSON
2022-06-07 14:40   ` Hans-Peter Nilsson [this message]
2022-06-07  6:18 ` Sebastian Huber
2022-06-07 19:31   ` Sebastian Huber
2022-06-07 23:30   ` Hans-Peter Nilsson

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=20220607144017.E678620419@pchp3.se.axis.com \
    --to=hp@axis.com \
    --cc=newlib@sourceware.org \
    --cc=torbjorn.svensson@st.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).