Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Oct 2002 00:50:04 -0700 (PDT)
From:      Lyndon Nerenberg <lyndon@orthanc.ab.ca>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/4672 rdist botches hardlink counts (take 2)
Message-ID:  <200210060750.g967o45l046411@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 (take 2)
Date: Sun, 06 Oct 2002 01:42:59 -0600

 Of course, my tests had pathname and src reversed, so remotename
 appeared to be a noop. In fact, it's needed, and the bug is remotename
 not just returning pathname if it contains no '/' characters.
 
 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:40:52
 @@ -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:40:52
 @@ -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:40:53
 @@ -315,6 +315,8 @@
  	int len;
  
  	cp = pathname;
 +	if (strchr(cp, '/') == NULL)
 +		return cp;
  	len = strlen(src);
  	if (0 == strncmp(pathname, src, len))
  		cp += len;
 @@ -389,14 +391,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?200210060750.g967o45l046411>