Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Mar 2018 17:23:35 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Conrad Meyer <cem@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss
Message-ID:  <20180321152335.GL76926@kib.kiev.ua>
In-Reply-To: <CAG6CVpW3tPVyh6D3FXpAc9DPqG9u_KnHBiZOFmg1zZsHmDb8jA@mail.gmail.com>
References:  <201803210115.w2L1Fjt9084698@repo.freebsd.org> <20180321103325.GJ76926@kib.kiev.ua> <CAG6CVpW3tPVyh6D3FXpAc9DPqG9u_KnHBiZOFmg1zZsHmDb8jA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Mar 21, 2018 at 08:03:16AM -0700, Conrad Meyer wrote:
> On Wed, Mar 21, 2018 at 3:33 AM, Konstantin Belousov
> <kostikbel@gmail.com> wrote:
> > On Wed, Mar 21, 2018 at 01:15:45AM +0000, Conrad Meyer wrote:
> >> +int
> >> +getentropy(void *buf, size_t buflen)
> >> +{
> >> +     ssize_t rd;
> >> +
> >> +     if (buflen > 256) {
> >> +             errno = EIO;
> >> +             return (-1);
> >> +     }
> >> +
> >> +     while (buflen > 0) {
> >> +             rd = getrandom(buf, buflen, 0);
> >> +             if (rd == -1) {
> >> +                     if (errno == EINTR)
> >> +                             continue;
> >> +                     else if (errno == ENOSYS)
> >> +                             abort();
> > Libraries must not abort the application.
> > Esp. libc.
> 
> What do you propose instead?  while (1); ?  I don't see that as
> obviously better.

Return the error to caller, as all, well most, correct library functions
do.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180321152335.GL76926>