[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: |
Michael Geng |
Subject: |
Re: truncate.c fails to compile on make distcheck |
Date: |
Wed, 25 Jun 2008 23:01:26 +0200 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
On Wed, Jun 25, 2008 at 07:21:51PM +0200, Jim Meyering wrote:
> Pádraig Brady <address@hidden> wrote:
> > Michael Geng wrote:
> >> Hi,
> >>
> >> When I'm running make distcheck on the Coreutils I get an error message
> >>
> >> ...
> >> gcc -std=gnu99 -I. -I../lib -I../lib -Werror -ansi -Wno-long-long -MT
> >> truncate.o -MD -MP -MF .deps/truncate.Tpo -c -o truncate.o truncate.c
> >> cc1: warnings being treated as errors
> >> truncate.c: In function 'parse_len':
> >> truncate.c:78: error: passing argument 4 of 'xstrtoimax' from incompatible
> >> pointer type
> >> make[6]: *** [truncate.o] Error 1
> >> ...
> >>
> >> I'm running Linux on a PC and I compiled the Coreutils from git
> >> from this morning bootstrapped with Gnulib also from git from
> >> this morning.
> >>
> >> Is this a bug in the Coreutils or is there something wrong on my system?
> >
> > What version of glibc are you using.
> > I make the assumption that OFF_T_MAX = INTMAX_MAX,
>
> Humph. I should have caught that in review.
> Here's a tentative patch:
>
> diff --git a/src/truncate.c b/src/truncate.c
> index 8febd58..52500d2 100644
> --- a/src/truncate.c
> +++ b/src/truncate.c
> @@ -74,10 +74,21 @@ static int
> parse_len (char const *str, off_t *size)
> {
> enum strtol_error e;
> - /* OFF_T_MAX = INTMAX_MAX */
> - e = xstrtoimax (str, NULL, 10, size, "EgGkKmMPtTYZ0");
> - errno = (e == LONGINT_OVERFLOW) ? EOVERFLOW : 0;
> - return (e == LONGINT_OK) ? 0 : -1;
> + intmax_t tmp_size;
> + e = xstrtoimax (str, NULL, 10, &tmp_size, "EgGkKmMPtTYZ0");
> + if (e == LONGINT_OK
> + && !(OFF_T_MIN <= tmp_size && tmp_size <= OFF_T_MAX))
> + e = LONGINT_OVERFLOW;
> +
> + if (e == LONGINT_OK)
> + {
> + errno = 0;
> + *size = tmp_size;
> + return 0;
> + }
> +
> + errno = (e == LONGINT_OVERFLOW ? EOVERFLOW : 0);
> + return -1;
> }
>
> static void
With your patch I could successfully compile the Coreutils
and it also passed make distcheck this time.
Thank you very much for providing the patch so quickly!
Michael
- Re: truncate.c fails to compile on make distcheck, (continued)
- 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, 2008/06/27
- 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 <=
Re: truncate.c fails to compile on make distcheck, Michael Geng, 2008/06/25