| 1 |
/** $MirOS: src/bin/pax/tables.c,v 1.6 2006/06/24 00:21:54 tg Exp $ */ |
/** $MirOS: src/bin/pax/tables.c,v 1.7 2007/02/17 04:52:41 tg Exp $ */ |
| 2 |
/* $OpenBSD: tables.c,v 1.23 2005/04/21 21:47:18 beck Exp $ */ |
/* $OpenBSD: tables.c,v 1.23 2005/04/21 21:47:18 beck Exp $ */ |
| 3 |
/* $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 $ */ |
| 4 |
|
|
| 50 |
#include "extern.h" |
#include "extern.h" |
| 51 |
|
|
| 52 |
__SCCSID("@(#)tables.c 8.1 (Berkeley) 5/31/93"); |
__SCCSID("@(#)tables.c 8.1 (Berkeley) 5/31/93"); |
| 53 |
__RCSID("$MirOS: src/bin/pax/tables.c,v 1.6 2006/06/24 00:21:54 tg Exp $"); |
__RCSID("$MirOS: src/bin/pax/tables.c,v 1.7 2007/02/17 04:52:41 tg Exp $"); |
| 54 |
|
|
| 55 |
/* |
/* |
| 56 |
* Routines for controlling the contents of all the different databases pax |
* Routines for controlling the contents of all the different databases pax |
| 169 |
arcn->ln_nlen = strlcpy(arcn->ln_name, pt->name, |
arcn->ln_nlen = strlcpy(arcn->ln_name, pt->name, |
| 170 |
sizeof(arcn->ln_name)); |
sizeof(arcn->ln_name)); |
| 171 |
/* XXX truncate? */ |
/* XXX truncate? */ |
| 172 |
if (arcn->nlen >= sizeof(arcn->name)) |
if ((size_t)arcn->nlen >= sizeof(arcn->name)) |
| 173 |
arcn->nlen = sizeof(arcn->name) - 1; |
arcn->nlen = sizeof(arcn->name) - 1; |
| 174 |
if (arcn->type == PAX_REG) |
if (arcn->type == PAX_REG) |
| 175 |
arcn->type = PAX_HRG; |
arcn->type = PAX_HRG; |
| 601 |
* and return (we know that oname has enough space) |
* and return (we know that oname has enough space) |
| 602 |
*/ |
*/ |
| 603 |
*onamelen = strlcpy(oname, pt->nname, onamesize); |
*onamelen = strlcpy(oname, pt->nname, onamesize); |
| 604 |
if (*onamelen >= onamesize) |
if ((size_t)*onamelen >= onamesize) |
| 605 |
*onamelen = onamesize - 1; /* XXX truncate? */ |
*onamelen = onamesize - 1; /* XXX truncate? */ |
| 606 |
return; |
return; |
| 607 |
} |
} |
| 1127 |
if (dirp == NULL) |
if (dirp == NULL) |
| 1128 |
return; |
return; |
| 1129 |
|
|
| 1130 |
if (dircnt == dirsize) { |
if (dircnt == (long)dirsize) { |
| 1131 |
dblk = realloc(dirp, 2 * dirsize * sizeof(DIRDATA)); |
dblk = realloc(dirp, 2 * dirsize * sizeof(DIRDATA)); |
| 1132 |
if (dblk == NULL) { |
if (dblk == NULL) { |
| 1133 |
paxwarn(1, "Unable to store mode and times for created" |
paxwarn(1, "Unable to store mode and times for created" |
| 1205 |
*/ |
*/ |
| 1206 |
|
|
| 1207 |
u_int |
u_int |
| 1208 |
st_hash(char *name, int len, int tabsz) |
st_hash(const char *name, int len, int tabsz) |
| 1209 |
{ |
{ |
| 1210 |
char *pt; |
const char *pt; |
| 1211 |
char *dest; |
char *dest; |
| 1212 |
char *end; |
const char *end; |
| 1213 |
int i; |
int i; |
| 1214 |
u_int key = 0; |
u_int key = 0; |
| 1215 |
int steps; |
int steps; |