[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#23825: maint: avoid md5sum.c warning from bleeding-edge gcc's -Wstri
From: |
Jim Meyering |
Subject: |
bug#23825: maint: avoid md5sum.c warning from bleeding-edge gcc's -Wstrict-overflow |
Date: |
Thu, 23 Jun 2016 11:29:06 -0600 |
On Thu, Jun 23, 2016 at 7:26 AM, Pádraig Brady <address@hidden> wrote:
> On 23/06/16 08:13, Paul Eggert wrote:
>> Incidentally, 'yes' has a different bug: it mishandles the case where
>> 'write' succeeds but returns a value less than the buffer size. I'll try
>> to look into that too. Simplest would be to use stdio (the comments
>> indicate this has performance issues but I don't know what they are,
>> anyway correctness trumps performance).
>
> Good spot on the yes(1) write(2) bug.
> Shouldn't impact too often due to smallish BUFSIZ,
> and subsequent writes catching ENOSPC,
> but definitely could cause issues.
>
> The attached should fix that up, and keep the same
> performance characteristics.
Hi Pádraig,
Thank you. That looks fine, modulo a formatting nit. I'd correct it like this:
-const char* pwrite = buf
+const char *pwrite = buf
Hi Paul,
Thank you, too.
I confirmed that all compile (using yesterday's gcc-7 snapshot) with
your patch. My only reservation is barely worth mentioning: the new
variable names, operandp and operand_lim are a bit too long for my
taste (at least in the files where all uses are very near the
definitions). On the other hand, they are also more readable than
alternatives that came to mind, and in some cases are used far enough
away from point of definition that one can justify that added length.