[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: truncate.c fails to compile on make distcheck
From: |
Pádraig Brady |
Subject: |
Re: truncate.c fails to compile on make distcheck |
Date: |
Sat, 28 Jun 2008 00:44:49 +0100 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20071008) |
Paul Eggert wrote:
> Pádraig Brady <address@hidden> writes:
>
>> diff --git a/src/truncate.c b/src/truncate.c
>> index 02d4102..fd321c6 100644
>> --- a/src/truncate.c
>> +++ b/src/truncate.c
>> @@ -189,9 +189,9 @@ do_ftruncate (int fd, char const *fname, off_t ssize,
>> rel_mode_t rel_mode)
>> }
>>
>> if (rel_mode == rm_min)
>> - nsize = MAX (fsize, ssize);
>> + nsize = MAX (fsize, (uintmax_t) ssize);
>> else if (rel_mode == rm_max)
>> - nsize = MIN (fsize, ssize);
>> + nsize = MIN (fsize, (uintmax_t) ssize);
>> else if (rel_mode == rm_rdn)
>> /* 0..ssize-1 -> 0 */
>> nsize = (fsize / ssize) * ssize;
>
> This patch does not look right to me. If ssize is negative, it screws up.
>
> Can ssize be negative? Yes it can.
Not when rel_mode is rm_min or rm_max.
> This indicates a bug in the underlying code, which GCC was right to
> warn us about, and which we should not have worked around by inserting
> casts blindly.
As I said in the patch the casts were to confirm the intent,
rather than just to silence the errors.
Pádraig.
- Re: truncate.c fails to compile on make distcheck, (continued)
- Re: truncate.c fails to compile on make distcheck, Jim Meyering, 2008/06/26
- Re: truncate.c fails to compile on make distcheck, Pádraig Brady, 2008/06/26
- Re: truncate.c fails to compile on make distcheck, Jim Meyering, 2008/06/26
- Re: truncate.c fails to compile on make distcheck, Pádraig Brady, 2008/06/26
- Re: truncate.c fails to compile on make distcheck, Jim Meyering, 2008/06/26
- Re: truncate.c fails to compile on make distcheck, Pádraig Brady, 2008/06/26
- Re: truncate.c fails to compile on make distcheck, Jim Meyering, 2008/06/27
- Re: truncate.c fails to compile on make distcheck, Pádraig Brady, 2008/06/27
- Re: truncate.c fails to compile on make distcheck, Jim Meyering, 2008/06/27
- Re: truncate.c fails to compile on make distcheck, Paul Eggert, 2008/06/27
- Re: truncate.c fails to compile on make distcheck,
Pádraig Brady <=
- Re: truncate.c fails to compile on make distcheck, Jim Meyering, 2008/06/28
- [PATCH] truncate: Ignore whitespace in --size parameters, Pádraig Brady, 2008/06/28
- Re: [PATCH] truncate: Ignore whitespace in --size parameters, Jim Meyering, 2008/06/30
- Message not available
- Re: [PATCH] truncate: Ignore whitespace in --size parameters, Jim Meyering, 2008/06/30
- Re: truncate.c fails to compile on make distcheck, Paul Eggert, 2008/06/26
- Re: truncate.c fails to compile on make distcheck, Jim Meyering, 2008/06/26
- Re: truncate.c fails to compile on make distcheck, Bruno Haible, 2008/06/26
- Re: truncate.c fails to compile on make distcheck, Michael Geng, 2008/06/25
Re: truncate.c fails to compile on make distcheck, Michael Geng, 2008/06/25