[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK7LNAQf_VTA31tFQAbZUkwLWihhqqiQqYQw6RqD93u-Ch4ZJg@mail.gmail.com>
Date: Sat, 23 May 2020 13:18:38 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
Jessica Yu <jeyu@...nel.org>,
Michal Marek <michal.lkml@...kovi.net>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 03/29] modpost: add read_text_file() and get_line() helpers
On Wed, May 20, 2020 at 9:29 PM Peter Zijlstra <peterz@...radead.org> wrote:
>
> On Wed, May 20, 2020 at 09:17:45PM +0900, Masahiro Yamada wrote:
>
> > The specification [1] says this:
> >
> > "The value returned may be less than nbyte if the number of bytes
> > left in the file is less than nbyte, if the read() request was
> > interrupted by a signal, or if the file is a pipe or FIFO or
> > special file and has fewer than nbyte bytes immediately available
> > for reading."
> >
> >
> > This case does not meet any of 'if ...' parts.
>
> So nobody ever ^Z's their build? I really don't think you can assume
> that you'll never get a signal. That's just asking for trouble.
>
> Doing the right thing here is 'trivial', there is absolutely no reason
> to not do it.
In my testing, read() seems robust against ^Z,
but perhaps it might be implementation-defined ?
I think you are right.
We can gain extra safety with a trivial change.
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists