mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Masahiro Yamada' <masahiroy@kernel.org>
Cc: "linux-kbuild@vger.kernel.org" <linux-kbuild@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Michal Marek <michal.lkml@markovi.net>,
	Nick Desaulniers <ndesaulniers@google.com>
Subject: RE: [PATCH] fixdep: use fflush() and ferror() to ensure successful write to files
Date: Tue, 22 Feb 2022 09:09:38 +0000	[thread overview]
Message-ID: <1b44951e776b4f4d9a5b786f2ba896d4@AcuMS.aculab.com> (raw)
In-Reply-To: <CAK7LNAQgucSQQLauRoaFza6YHGMBrSr+-ag1m=bmWXas5WEb0A@mail.gmail.com>

From: Masahiro Yamada <masahiroy@kernel.org>
> Sent: 22 February 2022 03:44
> 
> On Tue, Feb 22, 2022 at 7:33 AM David Laight <David.Laight@aculab.com> wrote:
> >
> > From: Masahiro Yamada
> > > Sent: 21 February 2022 16:43
> > > To: linux-kbuild@vger.kernel.org
> > >
> > > Checking the return value of (v)printf does not ensure the successful
> > > write to the .cmd file.
> > >
> > > Call fflush() and ferror() to make sure that everything has been
> > > written to the file.
> > >
> > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> >
> > Reviewed-by: David Laight <dvid.laight@aculab.com>
> >
> > I'll note that you've lost the perror("fixdep").
> > But I suspect that isn't very meaningful.
> > If the disk is full it'd probably get lost anyway.
> 
> 
> perror() will go to stderr, i.e. tty here.
> So, that is not the issue.
> 
> ferror() itself does not set errno here; "man ferror" says,
> "These  functions  should  not  fail  and  do  not set the external
> variable errno"
> 
> So, I dropped perror() because I am not sure if any related error
> message is printed here.
> 
> Perhaps, errno was set by some of preceding printf() calls,
> but I am not quite sure if it is carried all the way to the end
> of this program.

I was thinking or a slightly more descriptive error message :-)

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

      reply	other threads:[~2022-02-22  9:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-21 16:43 Masahiro Yamada
2022-02-21 22:33 ` David Laight
2022-02-22  3:44   ` Masahiro Yamada
2022-02-22  9:09     ` David Laight [this message]

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=1b44951e776b4f4d9a5b786f2ba896d4@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=ndesaulniers@google.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

all inboxes | Powered by JetHome®