Messages in this thread | | | From | David Laight <> | Subject | RE: [PATCH] fixdep: use fflush() and ferror() to ensure successful write to files | Date | Tue, 22 Feb 2022 09:09:38 +0000 |
| |
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)
| |