> 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?
Good point. Updated patch is below.
> Otherwise the getdents parts look fine to me.
Thank you for looking in.
--
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 14:42:13 -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 14:42:13 -0000
@@ -169,8 +169,8 @@ 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",
- historytab[type], time(NULL), getlogin(), cwd,
+ fprintf(fp, "%c%08llx|%s|%s|%s|%s|%s\n",
+ historytab[type], (long long)time(NULL),
getlogin(), cwd,
repo, rev, (cf != NULL) ? cf->file_name :
argument);
(void)fclose(fp);
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 14:42:13 -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;