[PATCH] libbb: Converted safe_read to safe_write format

Martin Lewis martin.lewis.x84 at gmail.com
Tue Oct 15 17:08:10 UTC 2019


A ping out of curiosity...

On Thu, 10 Oct 2019 at 16:33, Martin Lewis <martin.lewis.x84 at gmail.com> wrote:
>
> Hello,
>
> Could you please elaborate on what was lacking in the INT_MAX part?
> As seen in write's man page:
> >
> > On Linux, write() (and similar system calls) will transfer at most 0x7ffff000 (2,147,479,552) bytes, returning the number of bytes actually transferred.  (This  is  true  on
> >        both 32-bit and 64-bit systems.)
>
> Wouldn't it create an issue with 64 bit systems when trying to
> read/write large files?
>
> Thanks,
> Martin
>
>
> On Wed, 9 Oct 2019 at 07:37, Denys Vlasenko <vda.linux at googlemail.com> wrote:
> >
> > On Sun, Sep 15, 2019 at 6:14 PM Martin Lewis <martin.lewis.x84 at gmail.com> wrote:
> > >
> > > Changed safe_read to be symmetrical to safe_write, it shall
> > > never return EINTR because it calls read multiple times,
> > > the error is considered transient.
> >
> > Applied except this part:
> >
> > > Also, as seen in gnu coreutils, handle an edge case where count is bigger
> > > than INT_MAX by truncating it in order to avoid bugs on various linux platforms.


More information about the busybox mailing list