Date: Sun, 6 Oct 2002 00:30:04 -0700 (PDT) From: Lyndon Nerenberg <lyndon@orthanc.ab.ca> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/4672 rdist botches hardlink counts Message-ID: <200210060730.g967U47V038941@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/4672; it has been noted by GNATS.
From: Lyndon Nerenberg <lyndon@orthanc.ab.ca>
To: freebsd-gnats-submit@FreeBSD.org
Cc:
Subject: Re: bin/4672 rdist botches hardlink counts
Date: Sun, 06 Oct 2002 01:25:22 -0600
The call to remotename() is returning a zero-length filename for
the link source, thus rdist is sending the name of the source's
directory, and not the complete path to the source file. After
reading the code, I can't see the purpose of the remotename()
call, since it doesn't appear that lp->src and lp->pathname can
ever hold different strings (in the hardlink case). The attached
patch fixes the problem described in the pr, and quells a couple
of printf argument warnings from a -Wall compile.
Index: defs.h
===================================================================
RCS file: /home/ncvs/src/usr.bin/rdist/Attic/defs.h,v
retrieving revision 1.6
diff -u -r1.6 defs.h
--- defs.h 1998/04/20 06:20:19 1.6
+++ defs.h 2002/10/06 07:15:15
@@ -137,7 +137,7 @@
struct linkbuf {
ino_t inum;
dev_t devnum;
- int count;
+ u_int count;
char pathname[BUFSIZ];
char src[BUFSIZ];
char target[BUFSIZ];
Index: docmd.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/rdist/Attic/docmd.c,v
retrieving revision 1.12
diff -u -r1.12 docmd.c
--- docmd.c 1999/08/28 01:05:06 1.12
+++ docmd.c 2002/10/06 07:15:15
@@ -194,8 +194,8 @@
nextihead = ihead->nextp;
if ((opts & IGNLNKS) || ihead->count == 0)
continue;
- log(lfp, "%s: Warning: missing links\n",
- ihead->pathname);
+ log(lfp, "%s: Warning: missing links (%u)\n",
+ ihead->pathname, ihead->count);
free(ihead);
}
}
Index: server.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/rdist/Attic/server.c,v
retrieving revision 1.10
diff -u -r1.10 server.c
--- server.c 1999/08/28 01:05:09 1.10
+++ server.c 2002/10/06 07:15:16
@@ -334,8 +334,7 @@
opts, lp->pathname, rname);
else
(void) snprintf(buf, sizeof(buf), "k%o %s/%s %s\n",
- opts, lp->target,
- remotename(lp->pathname, lp->src), rname);
+ opts, lp->target, lp->pathname, rname);
if (debug) {
printf("lp->src = %s\n", lp->src);
@@ -389,14 +388,16 @@
log(lfp, "%s: no password entry for uid %d \n",
target, stb.st_uid);
pw = NULL;
- (void)snprintf(user, sizeof(user), ":%lu", stb.st_uid);
+ (void)snprintf(user, sizeof(user), ":%lu",
+ (unsigned long)stb.st_uid);
}
if (gr == NULL || gr->gr_gid != stb.st_gid)
if ((gr = getgrgid(stb.st_gid)) == NULL) {
log(lfp, "%s: no name for group %d\n",
- target, stb.st_gid);
+ target, (unsigned long)stb.st_gid);
gr = NULL;
- (void)snprintf(group, sizeof(group), ":%lu", stb.st_gid);
+ (void)snprintf(group, sizeof(group), ":%lu",
+ (unsigned long)stb.st_gid);
}
if (u == 1) {
if (opts & VERIFY) {
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210060730.g967U47V038941>
