]> git.pld-linux.org Git - packages/rdist.git/blame - rdist-links.patch
- release 34
[packages/rdist.git] / rdist-links.patch
CommitLineData
5b843246
JR
1--- rdist-6.1.5/src/client.c.links Wed Feb 17 17:46:09 1999
2+++ rdist-6.1.5/src/client.c Wed Feb 17 17:51:15 1999
3@@ -309,6 +309,18 @@
4 return(0);
5 }
6
7+void freelinkinfo(lp)
8+ struct linkbuf *lp;
9+{
10+ if (lp->pathname)
11+ free(lp->pathname);
12+ if (lp->src)
13+ free(lp->src);
14+ if (lp->target)
15+ free(lp->target);
16+ free(lp);
17+}
18+
19 /*
20 * Save and retrieve hard link info
21 */
22@@ -317,6 +329,7 @@
23 {
24 struct linkbuf *lp;
25
26+ /* xxx: linear search doesn't scale with many links */
27 for (lp = ihead; lp != NULL; lp = lp->nextp)
28 if (lp->inum == statp->st_ino && lp->devnum == statp->st_dev) {
29 lp->count--;
30@@ -329,12 +342,14 @@
31 lp->inum = statp->st_ino;
32 lp->devnum = statp->st_dev;
33 lp->count = statp->st_nlink - 1;
34- (void) strcpy(lp->pathname, target);
35- (void) strcpy(lp->src, source);
36+ lp->pathname = strdup(target);
37+ lp->src = strdup(source);
38 if (Tdest)
39- (void) strcpy(lp->target, Tdest);
40+ lp->target = strdup(Tdest);
41 else
42- *lp->target = CNULL;
43+ lp->target = NULL;
44+ if (!lp->pathname || !lp->src || !(Tdest && lp->target))
45+ fatalerr("Cannot malloc memory in linkinfo.");
46
47 return((struct linkbuf *) NULL);
48 }
49--- rdist-6.1.5/src/docmd.c.links Wed Feb 17 17:51:23 1999
50+++ rdist-6.1.5/src/docmd.c Wed Feb 17 17:52:44 1999
51@@ -586,7 +586,7 @@
52 if (!nflag) {
53 register struct linkbuf *nextl, *l;
54
55- for (l = ihead; l != NULL; free((char *)l), l = nextl) {
56+ for (l = ihead; l != NULL; freelinkinfo(l), l = nextl) {
57 nextl = l->nextp;
58 if (contimedout || IS_ON(opts, DO_IGNLNKS) ||
59 l->count == 0)
60--- rdist-6.1.5/include/defs.h.links Wed Feb 17 17:52:58 1999
61+++ rdist-6.1.5/include/defs.h Wed Feb 17 17:53:47 1999
62@@ -276,9 +276,9 @@
63 ino_t inum;
64 dev_t devnum;
65 int count;
66- char pathname[BUFSIZ];
67- char src[BUFSIZ];
68- char target[BUFSIZ];
69+ char *pathname;
70+ char *src;
71+ char *target;
72 struct linkbuf *nextp;
73 };
74
This page took 0.0772 seconds and 4 git commands to generate.