|
Message-ID: <CACJ51z3bGQ-sfoJ2z4sd1mOzqkWxhUvZCG9c71RU9OyCg9ZOaQ@mail.gmail.com>
Date: Wed, 14 Feb 2018 15:11:34 -0500
From: Andrew Bell <andrew.bell.ia@...il.com>
To: musl@...ts.openwall.com
Subject: Re: fwrite() - possible division by zero
On Wed, Feb 14, 2018 at 3:07 PM, Markus Wichmann <nullplan@....net> wrote:
> On Wed, Feb 14, 2018 at 02:48:14PM -0500, Andrew Bell wrote:
> > Why not early return if size == 0 and avoid the call to __fwritex
> > altogether?
> >
>
> Because it's a rare corner case? Here, there's also locking correctness
> to consider: fwrite() has to block until f is unlocked, irrespective of
> parameters. So there's no real benefit to doing an early return.
>
But it's already being checked to set nmemb to 0. Couldn't you just return
0 and avoid the lock as well?
--
Andrew Bell
andrew.bell.ia@...il.com
Content of type "text/html" skipped
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.