summaryrefslogtreecommitdiff
path: root/net/rdist6/patches/patch-an
diff options
context:
space:
mode:
Diffstat (limited to 'net/rdist6/patches/patch-an')
-rw-r--r--net/rdist6/patches/patch-an93
1 files changed, 81 insertions, 12 deletions
diff --git a/net/rdist6/patches/patch-an b/net/rdist6/patches/patch-an
index 5812af74ba6..0b5920894a2 100644
--- a/net/rdist6/patches/patch-an
+++ b/net/rdist6/patches/patch-an
@@ -1,33 +1,102 @@
-$NetBSD: patch-an,v 1.1 2010/03/07 08:52:27 lukem Exp $
+$NetBSD: patch-an,v 1.2 2010/06/12 19:36:01 dholland Exp $
+
+Print and parse time_t as intmax_t, not as long (which might not fit).
+Likewise for (perhaps only some uses of) off_t.
--- src/client.c.orig 1999-11-01 00:22:14.000000000 +0000
+++ src/client.c
-@@ -435,7 +435,7 @@ static int sendfile(rname, opts, stb, us
+@@ -433,9 +433,9 @@ static int sendfile(rname, opts, stb, us
+ debugmsg(DM_MISC, "Turning off compression");
+ }
- (void) sendcmd(C_RECVREG, "%o %04o %ld %ld %ld %s %s %s",
- opts, stb->st_mode & 07777, (long) stb->st_size,
+- (void) sendcmd(C_RECVREG, "%o %04o %ld %ld %ld %s %s %s",
+- opts, stb->st_mode & 07777, (long) stb->st_size,
- stb->st_mtime, stb->st_atime,
-+ (long)stb->st_mtime, (long)stb->st_atime,
++ (void) sendcmd(C_RECVREG, "%o %04o %jd %jd %jd %s %s %s",
++ opts, stb->st_mode & 07777, (intmax_t) stb->st_size,
++ (intmax_t)stb->st_mtime, (intmax_t)stb->st_atime,
user, group, ername);
if (response() < 0) {
(void) close(f);
-@@ -734,7 +734,7 @@ static int sendlink(rname, opts, stb, us
+@@ -450,8 +450,8 @@ static int sendfile(rname, opts, stb, us
+ }
+ }
+
+- debugmsg(DM_MISC, "Send file '%s' %ld bytes%s\n", rname,
+- (long) stb->st_size, rem_wz ? " (compressing)" : "");
++ debugmsg(DM_MISC, "Send file '%s' %jd bytes%s\n", rname,
++ (intmax_t) stb->st_size, rem_wz ? " (compressing)" : "");
+
+ /*
+ * Set remote time out alarm handler.
+@@ -732,9 +732,9 @@ static int sendlink(rname, opts, stb, us
+ * Gather and send basic link info
+ */
ENCODE(ername, rname);
- (void) sendcmd(C_RECVSYMLINK, "%o %04o %ld %ld %ld %s %s %s",
- opts, stb->st_mode & 07777, (long) stb->st_size,
+- (void) sendcmd(C_RECVSYMLINK, "%o %04o %ld %ld %ld %s %s %s",
+- opts, stb->st_mode & 07777, (long) stb->st_size,
- stb->st_mtime, stb->st_atime,
-+ (long)stb->st_mtime, (long)stb->st_atime,
++ (void) sendcmd(C_RECVSYMLINK, "%o %04o %jd %jd %jd %s %s %s",
++ opts, stb->st_mode & 07777, (intmax_t) stb->st_size,
++ (intmax_t)stb->st_mtime, (intmax_t)stb->st_atime,
user, group, ername);
if (response() < 0)
return(-1);
-@@ -973,8 +973,8 @@ static int update(rname, opts, statp)
+@@ -833,6 +833,7 @@ static int update(rname, opts, statp)
+ {
+ off_t size;
+ time_t mtime;
++ intmax_t size_big, mtime_big;
+ unsigned short lmode;
+ unsigned short rmode;
+ char *owner = NULL, *group = NULL;
+@@ -921,7 +922,12 @@ static int update(rname, opts, statp)
+ /*
+ * Parse size
+ */
+- size = (off_t) strtol(cp, (char **)&cp, 10);
++ size_big = strtoimax(cp, (char **)&cp, 10);
++ if ((intmax_t)(off_t)size_big != size_big) {
++ error("update: size out of range");
++ return(US_NOTHING);
++ }
++ size = (off_t)size_big;
+ if (*cp++ != ' ') {
+ error("update: size not delimited");
+ return(US_NOTHING);
+@@ -930,7 +936,12 @@ static int update(rname, opts, statp)
+ /*
+ * Parse mtime
+ */
+- mtime = strtol(cp, (char **)&cp, 10);
++ mtime_big = strtoimax(cp, (char **)&cp, 10);
++ if ((intmax_t)(off_t)mtime_big != mtime_big) {
++ error("update: mtime out of range");
++ return(US_NOTHING);
++ }
++ mtime = (time_t)mtime_big;
+ if (*cp++ != ' ') {
+ error("update: mtime not delimited");
+ return(US_NOTHING);
+@@ -973,8 +984,8 @@ static int update(rname, opts, statp)
debugmsg(DM_MISC, "update(%s,) local mode %04o remote mode %04o\n",
rname, lmode, rmode);
- debugmsg(DM_MISC, "update(%s,) size %ld mtime %d owner '%s' grp '%s'\n",
- rname, (long) size, mtime, owner, group);
-+ debugmsg(DM_MISC, "update(%s,) size %ld mtime %ld owner '%s' grp '%s'\n",
-+ rname, (long) size, (long)mtime, owner, group);
++ debugmsg(DM_MISC, "update(%s,) size %jd mtime %jd owner '%s' grp '%s'\n",
++ rname, (intmax_t)size, (intmax_t)mtime, owner, group);
if (statp->st_mtime != mtime) {
if (statp->st_mtime < mtime && IS_ON(opts, DO_YOUNGER)) {
+@@ -987,8 +998,8 @@ static int update(rname, opts, statp)
+ }
+
+ if (statp->st_size != size) {
+- debugmsg(DM_MISC, "size does not match (%ld != %ld).\n",
+- (long) statp->st_size, (long) size);
++ debugmsg(DM_MISC, "size does not match (%jd != %jd).\n",
++ (intmax_t)statp->st_size, (intmax_t)size);
+ return(US_OUTDATE);
+ }
+