| 1 |
/** $MirOS: src/bin/pax/tables.c,v 1.7 2007/02/17 04:52:41 tg Exp $ */ |
/* $OpenBSD: tables.c,v 1.25 2007/09/02 15:19:08 deraadt Exp $ */ |
|
/* $OpenBSD: tables.c,v 1.23 2005/04/21 21:47:18 beck Exp $ */ |
|
| 2 |
/* $NetBSD: tables.c,v 1.4 1995/03/21 09:07:45 cgd Exp $ */ |
/* $NetBSD: tables.c,v 1.4 1995/03/21 09:07:45 cgd Exp $ */ |
| 3 |
|
|
| 4 |
/*- |
/*- |
| 49 |
#include "extern.h" |
#include "extern.h" |
| 50 |
|
|
| 51 |
__SCCSID("@(#)tables.c 8.1 (Berkeley) 5/31/93"); |
__SCCSID("@(#)tables.c 8.1 (Berkeley) 5/31/93"); |
| 52 |
__RCSID("$MirOS: src/bin/pax/tables.c,v 1.7 2007/02/17 04:52:41 tg Exp $"); |
__RCSID("$MirOS: src/bin/pax/tables.c,v 1.8 2007/10/23 20:07:42 tg Exp $"); |
| 53 |
|
|
| 54 |
/* |
/* |
| 55 |
* Routines for controlling the contents of all the different databases pax |
* Routines for controlling the contents of all the different databases pax |
| 147 |
indx = ((unsigned)arcn->sb.st_ino) % L_TAB_SZ; |
indx = ((unsigned)arcn->sb.st_ino) % L_TAB_SZ; |
| 148 |
if ((pt = ltab[indx]) != NULL) { |
if ((pt = ltab[indx]) != NULL) { |
| 149 |
/* |
/* |
| 150 |
* it's hash chain in not empty, walk down looking for it |
* its hash chain in not empty, walk down looking for it |
| 151 |
*/ |
*/ |
| 152 |
ppt = &(ltab[indx]); |
ppt = &(ltab[indx]); |
| 153 |
while (pt != NULL) { |
while (pt != NULL) { |
| 1098 |
return(0); |
return(0); |
| 1099 |
|
|
| 1100 |
dirsize = DIRP_SIZE; |
dirsize = DIRP_SIZE; |
| 1101 |
if ((dirp = malloc(dirsize * sizeof(DIRDATA))) == NULL) { |
if ((dirp = calloc(dirsize, sizeof(DIRDATA))) == NULL) { |
| 1102 |
paxwarn(1, "Unable to allocate memory for directory times"); |
paxwarn(1, "Unable to allocate memory for directory times"); |
| 1103 |
return(-1); |
return(-1); |
| 1104 |
} |
} |
| 1122 |
add_dir(char *name, struct stat *psb, int frc_mode) |
add_dir(char *name, struct stat *psb, int frc_mode) |
| 1123 |
{ |
{ |
| 1124 |
DIRDATA *dblk; |
DIRDATA *dblk; |
| 1125 |
|
char realname[MAXPATHLEN], *rp; |
| 1126 |
|
|
| 1127 |
if (dirp == NULL) |
if (dirp == NULL) |
| 1128 |
return; |
return; |
| 1129 |
|
|
| 1130 |
|
if (havechd && *name != '/') { |
| 1131 |
|
if ((rp = realpath(name, realname)) == NULL) { |
| 1132 |
|
paxwarn(1, "Cannot canonicalize %s", name); |
| 1133 |
|
return; |
| 1134 |
|
} |
| 1135 |
|
name = rp; |
| 1136 |
|
} |
| 1137 |
if (dircnt == (long)dirsize) { |
if (dircnt == (long)dirsize) { |
| 1138 |
dblk = realloc(dirp, 2 * dirsize * sizeof(DIRDATA)); |
dblk = realloc(dirp, 2 * dirsize * sizeof(DIRDATA)); |
| 1139 |
if (dblk == NULL) { |
if (dblk == NULL) { |