[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1b44951e776b4f4d9a5b786f2ba896d4@AcuMS.aculab.com>
Date: Tue, 22 Feb 2022 09:09:38 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Masahiro Yamada' <masahiroy@...nel.org>
CC: "linux-kbuild@...r.kernel.org" <linux-kbuild@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Michal Marek <michal.lkml@...kovi.net>,
Nick Desaulniers <ndesaulniers@...gle.com>
Subject: RE: [PATCH] fixdep: use fflush() and ferror() to ensure successful
write to files
From: Masahiro Yamada <masahiroy@...nel.org>
> Sent: 22 February 2022 03:44
>
> On Tue, Feb 22, 2022 at 7:33 AM David Laight <David.Laight@...lab.com> wrote:
> >
> > From: Masahiro Yamada
> > > Sent: 21 February 2022 16:43
> > > To: linux-kbuild@...r.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@...nel.org>
> >
> > Reviewed-by: David Laight <dvid.laight@...lab.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)
Powered by blists - more mailing lists