2013/12/13 Jérémie Courrèges-Anglas <[email protected]>:
> Vadim Zhukov <[email protected]> writes:
>
>>> Vadim Zhukov <[email protected]> writes:
>>>
>>> > This patch addresses two problems:
>>> >
>>> > 1) Usage of getdirentries() - seriously.
>>> > 2) 64-bit-time_t fix.
>>>
>>> time_t should be printed with %ll? plus a (long long) cast.  Now,
>>> I don't see any (long long) cast in the whole OpenCVS code, and GNU
>>> cvs uses %08lx and (long) to print the current time...
>>>
>>> Maybe use %08llx?
>
> Similar diff for GNU cvs.  <Insert joke about CVS and 2038 here>
>
>
> Index: history.c
> ===================================================================
> RCS file: /cvs/src/gnu/usr.bin/cvs/src/history.c,v
> retrieving revision 1.3
> diff -u -p -r1.3 history.c
> --- history.c   3 Dec 2013 01:32:49 -0000       1.3
> +++ history.c   13 Dec 2013 15:56:24 -0000
> @@ -866,8 +866,8 @@ history_write (type, update_dir, revs, n
>         revs = "";
>      line = xmalloc (strlen (username) + strlen (workdir) + strlen (repos)
>                     + strlen (revs) + strlen (name) + 100);
> -    sprintf (line, "%c%08lx|%s|%s|%s|%s|%s\n",
> -            type, (long) time ((time_t *) NULL),
> +    sprintf (line, "%c%08llx|%s|%s|%s|%s|%s\n",
> +            type, (long long) time ((time_t *) NULL),
>              username, workdir, repos, revs, name);
>
>      /* Lessen some race conditions on non-Posix-compliant hosts.  */
>
>
> [...]

Looks fine for me - but I can't say if we care about upstream
compatibility for src/gnu/usr.bin/cvs? If no, we could also zap a
useless cast of NULL to (time_t*) here, saving the line length (well,
I forgot to mention 2038 here. Oops). :)

--
  WBR,
  Vadim Zhukov

Reply via email to