version 1.7, 1998/06/26 21:21:00 |
version 1.8, 1999/02/04 23:18:57 |
|
|
|
|
if (isokay) { |
if (isokay) { |
new = (struct namelist *) xmalloc(sizeof(struct namelist)); |
new = (struct namelist *) xmalloc(sizeof(struct namelist)); |
new->n_name = strdup(rfile); |
new->n_name = xstrdup(rfile); |
new->n_next = updfilelist; |
new->n_next = updfilelist; |
updfilelist = new; |
updfilelist = new; |
} |
} |
|
|
return(0); |
return(0); |
} |
} |
|
|
|
void freelinkinfo(lp) |
|
struct linkbuf *lp; |
|
{ |
|
if (lp->pathname) |
|
free(lp->pathname); |
|
if (lp->src) |
|
free(lp->src); |
|
if (lp->target) |
|
free(lp->target); |
|
free(lp); |
|
} |
|
|
/* |
/* |
* Save and retrieve hard link info |
* Save and retrieve hard link info |
*/ |
*/ |
|
|
{ |
{ |
struct linkbuf *lp; |
struct linkbuf *lp; |
|
|
|
/* XXX - linear search doesn't scale with many links */ |
for (lp = ihead; lp != NULL; lp = lp->nextp) |
for (lp = ihead; lp != NULL; lp = lp->nextp) |
if (lp->inum == statp->st_ino && lp->devnum == statp->st_dev) { |
if (lp->inum == statp->st_ino && lp->devnum == statp->st_dev) { |
lp->count--; |
lp->count--; |
|
|
lp->inum = statp->st_ino; |
lp->inum = statp->st_ino; |
lp->devnum = statp->st_dev; |
lp->devnum = statp->st_dev; |
lp->count = statp->st_nlink - 1; |
lp->count = statp->st_nlink - 1; |
(void) strcpy(lp->pathname, target); |
lp->pathname = xstrdup(target); |
(void) strcpy(lp->src, source); |
lp->src = xstrdup(source); |
if (Tdest) |
if (Tdest) |
(void) strcpy(lp->target, Tdest); |
lp->target = xstrdup(Tdest); |
else |
else |
*lp->target = CNULL; |
lp->target = NULL; |
|
if (!lp->pathname || !lp->src || !(Tdest && lp->target)) |
|
fatalerr("Cannot malloc memory in linkinfo."); |
|
|
return(NULL); |
return(NULL); |
} |
} |