tables.c (76019) | tables.c (76351) |
---|---|
1/*- 2 * Copyright (c) 1992 Keith Muller. 3 * Copyright (c) 1992, 1993 4 * The Regents of the University of California. All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * Keith Muller of the University of California, San Diego. 8 * --- 26 unchanged lines hidden (view full) --- 35 * SUCH DAMAGE. 36 */ 37 38#ifndef lint 39#if 0 40static char sccsid[] = "@(#)tables.c 8.1 (Berkeley) 5/31/93"; 41#endif 42static const char rcsid[] = | 1/*- 2 * Copyright (c) 1992 Keith Muller. 3 * Copyright (c) 1992, 1993 4 * The Regents of the University of California. All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * Keith Muller of the University of California, San Diego. 8 * --- 26 unchanged lines hidden (view full) --- 35 * SUCH DAMAGE. 36 */ 37 38#ifndef lint 39#if 0 40static char sccsid[] = "@(#)tables.c 8.1 (Berkeley) 5/31/93"; 41#endif 42static const char rcsid[] = |
43 "$FreeBSD: head/bin/pax/tables.c 76019 2001-04-26 09:22:28Z kris $"; | 43 "$FreeBSD: head/bin/pax/tables.c 76351 2001-05-08 06:19:06Z kris $"; |
44#endif /* not lint */ 45 46#include <sys/types.h> 47#include <sys/time.h> 48#include <sys/stat.h> 49#include <sys/fcntl.h> 50#include <errno.h> 51#include <stdio.h> --- 123 unchanged lines hidden (view full) --- 175 if (pt != NULL) { 176 /* 177 * found a link. set the node type and copy in the 178 * name of the file it is to link to. we need to 179 * handle hardlinks to regular files differently than 180 * other links. 181 */ 182 arcn->ln_nlen = l_strncpy(arcn->ln_name, pt->name, | 44#endif /* not lint */ 45 46#include <sys/types.h> 47#include <sys/time.h> 48#include <sys/stat.h> 49#include <sys/fcntl.h> 50#include <errno.h> 51#include <stdio.h> --- 123 unchanged lines hidden (view full) --- 175 if (pt != NULL) { 176 /* 177 * found a link. set the node type and copy in the 178 * name of the file it is to link to. we need to 179 * handle hardlinks to regular files differently than 180 * other links. 181 */ 182 arcn->ln_nlen = l_strncpy(arcn->ln_name, pt->name, |
183 PAXPATHLEN+1); 184 arcn->ln_name[PAXPATHLEN] = '\0'; | 183 sizeof(arcn->ln_name) - 1); 184 arcn->ln_name[arcn->ln_nlen] = '\0'; |
185 if (arcn->type == PAX_REG) 186 arcn->type = PAX_HRG; 187 else 188 arcn->type = PAX_HLK; 189 190 /* 191 * if we have found all the links to this file, remove 192 * it from the database --- 426 unchanged lines hidden (view full) --- 619 * sub_name() 620 * look up a link name to see if it points at a file that has been 621 * remapped by the user. If found, the link is adjusted to contain the 622 * new name (oname is the link to name) 623 */ 624 625#ifdef __STDC__ 626void | 185 if (arcn->type == PAX_REG) 186 arcn->type = PAX_HRG; 187 else 188 arcn->type = PAX_HLK; 189 190 /* 191 * if we have found all the links to this file, remove 192 * it from the database --- 426 unchanged lines hidden (view full) --- 619 * sub_name() 620 * look up a link name to see if it points at a file that has been 621 * remapped by the user. If found, the link is adjusted to contain the 622 * new name (oname is the link to name) 623 */ 624 625#ifdef __STDC__ 626void |
627sub_name(register char *oname, int *onamelen) | 627sub_name(register char *oname, int *onamelen, size_t onamesize) |
628#else 629void | 628#else 629void |
630sub_name(oname, onamelen) | 630sub_name(oname, onamelen, onamesize) |
631 register char *oname; 632 int *onamelen; | 631 register char *oname; 632 int *onamelen; |
633 size_t onamesize; |
|
633#endif 634{ 635 register NAMT *pt; 636 register u_int indx; 637 638 if (ntab == NULL) 639 return; 640 /* --- 7 unchanged lines hidden (view full) --- 648 /* 649 * walk down the hash chain looking for a match 650 */ 651 if (strcmp(oname, pt->oname) == 0) { 652 /* 653 * found it, replace it with the new name 654 * and return (we know that oname has enough space) 655 */ | 634#endif 635{ 636 register NAMT *pt; 637 register u_int indx; 638 639 if (ntab == NULL) 640 return; 641 /* --- 7 unchanged lines hidden (view full) --- 649 /* 650 * walk down the hash chain looking for a match 651 */ 652 if (strcmp(oname, pt->oname) == 0) { 653 /* 654 * found it, replace it with the new name 655 * and return (we know that oname has enough space) 656 */ |
656 *onamelen = l_strncpy(oname, pt->nname, PAXPATHLEN+1); 657 oname[PAXPATHLEN] = '\0'; | 657 *onamelen = l_strncpy(oname, pt->nname, onamesize - 1); 658 oname[*onamelen] = '\0'; |
658 return; 659 } 660 pt = pt->fow; 661 } 662 663 /* 664 * no match, just return 665 */ --- 760 unchanged lines hidden --- | 659 return; 660 } 661 pt = pt->fow; 662 } 663 664 /* 665 * no match, just return 666 */ --- 760 unchanged lines hidden --- |