Re: [PATCH v5 6/8] Introduce a new data type for timestamps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Hannes,

On Wed, 26 Apr 2017, Johannes Sixt wrote:

> Am 24.04.2017 um 15:58 schrieb Johannes Schindelin:
> > diff --git a/archive-tar.c b/archive-tar.c
> > index 380e3aedd23..695339a2369 100644
> > --- a/archive-tar.c
> > +++ b/archive-tar.c
> > @@ -27,9 +27,12 @@ static int write_tar_filter_archive(const struct archiver *ar,
> >   */
> >  #if ULONG_MAX == 0xFFFFFFFF
> >  #define USTAR_MAX_SIZE ULONG_MAX
> > -#define USTAR_MAX_MTIME ULONG_MAX
> >  #else
> >  #define USTAR_MAX_SIZE 077777777777UL
> > +#endif
> 
> This part of the hunk is fine: if ULONG_MAX is not 2^32-1, then 2^33-1
> will fit in a long.
> 
> > +#if TIME_MAX == 0xFFFFFFFF
> > +#define USTAR_MAX_MTIME TIME_MAX
> > +#else
> >  #define USTAR_MAX_MTIME 077777777777UL
> >  #endif
> 
> But this is not: just because TIME_MAX is not 32 bits, does not mean that
> long is also more than 32 bits. We need this:
> 
> diff --git a/archive-tar.c b/archive-tar.c
> index aadd5865f6..b5d6ce27d3 100644
> --- a/archive-tar.c
> +++ b/archive-tar.c
> @@ -33,7 +33,7 @@ static int write_tar_filter_archive(const struct archiver *ar,
>  #if TIME_MAX == 0xFFFFFFFF
>  #define USTAR_MAX_MTIME TIME_MAX
>  #else
> -#define USTAR_MAX_MTIME 077777777777UL
> +#define USTAR_MAX_MTIME 077777777777ULL
>  #endif
>  
>  /* writes out the whole block, but only if it is full */

Right! Thank you, v6 coming up,
Dscho



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]