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?

Otherwise the getdents parts look fine to me.

> Of course, this could be zapped as well, but I plan to dig this code
> at some point after getting KDE 4.12 working...
> --
> zhuk@
>
>
> Index: file.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/cvs/file.c,v
> retrieving revision 1.262
> diff -u -p -r1.262 file.c
> --- file.c    28 Oct 2010 15:02:41 -0000      1.262
> +++ file.c    13 Dec 2013 12:29:18 -0000
> @@ -30,6 +30,7 @@
>  #include <sys/stat.h>
>  #include <sys/time.h>
>  
> +#include <dirent.h>
>  #include <errno.h>
>  #include <fcntl.h>
>  #include <fnmatch.h>
> @@ -393,7 +394,6 @@ cvs_file_walkdir(struct cvs_file *cf, st
>       int l, type;
>       FILE *fp;
>       int nbytes;
> -     off_t base;
>       size_t bufsize;
>       struct stat st;
>       struct dirent *dp;
> @@ -472,7 +472,7 @@ cvs_file_walkdir(struct cvs_file *cf, st
>       RB_INIT(&fl);
>       RB_INIT(&dl);
>  
> -     while ((nbytes = getdirentries(cf->fd, buf, bufsize, &base)) > 0) {
> +     while ((nbytes = getdents(cf->fd, buf, bufsize)) > 0) {
>               ebuf = buf + nbytes;
>               cp = buf;
>  
> Index: history.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/cvs/history.c,v
> retrieving revision 1.40
> diff -u -p -r1.40 history.c
> --- history.c 23 Jul 2010 21:46:05 -0000      1.40
> +++ history.c 13 Dec 2013 12:29:18 -0000
> @@ -169,7 +169,7 @@ cvs_history_add(int type, struct cvs_fil
>                       cvs_log(LP_ERR, "failed to open history file");
>       } else {
>               if ((fp = fdopen(fd, "a")) != NULL) {
> -                     fprintf(fp, "%c%x|%s|%s|%s|%s|%s\n",
> +                     fprintf(fp, "%c%llx|%s|%s|%s|%s|%s\n",
>                           historytab[type], time(NULL), getlogin(), cwd,
>                           repo, rev, (cf != NULL) ? cf->file_name :
>                           argument);
> Index: update.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/cvs/update.c,v
> retrieving revision 1.167
> diff -u -p -r1.167 update.c
> --- update.c  2 Jul 2012 21:56:25 -0000       1.167
> +++ update.c  13 Dec 2013 12:29:18 -0000
> @@ -17,6 +17,7 @@
>  
>  #include <sys/stat.h>
>  
> +#include <dirent.h>
>  #include <errno.h>
>  #include <fcntl.h>
>  #include <string.h>
> @@ -235,7 +236,6 @@ cvs_update_enterdir(struct cvs_file *cf)
>  void
>  cvs_update_leavedir(struct cvs_file *cf)
>  {
> -     off_t base;
>       int nbytes;
>       int isempty;
>       size_t bufsize;
> @@ -272,7 +272,7 @@ cvs_update_leavedir(struct cvs_file *cf)
>       if (lseek(cf->fd, 0, SEEK_SET) == -1)
>               fatal("cvs_update_leavedir: %s", strerror(errno));
>  
> -     while ((nbytes = getdirentries(cf->fd, buf, bufsize, &base)) > 0) {
> +     while ((nbytes = getdents(cf->fd, buf, bufsize)) > 0) {
>               ebuf = buf + nbytes;
>               cp = buf;
>  
>

-- 
jca | PGP: 0x06A11494 / 61DB D9A0 00A4 67CF 2A90  8961 6191 8FBF 06A1 1494

Reply via email to