X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=restore%2Fsymtab.c;h=a72b1cbb2cab05b0f686bbd5947293218d4730c2;hb=401a4d13e4c30d46074531c6c26efefcaf3bbdaf;hp=f44b5c65c1124d6ce40227d09abe3bee897a43eb;hpb=ebcbe7f6c10482913b60fc792e72e494b439b242;p=dump.git diff --git a/restore/symtab.c b/restore/symtab.c index f44b5c6..a72b1cb 100644 --- a/restore/symtab.c +++ b/restore/symtab.c @@ -2,7 +2,8 @@ * Ported to Linux's Second Extended File System as part of the * dump and restore backup suit * Remy Card , 1994-1997 - * Stelian Pop , 1999-2000 + * Stelian Pop , 1999-2000 + * Stelian Pop - AlcĂ´ve , 2000 */ /* @@ -40,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: symtab.c,v 1.7 2000/01/21 10:17:41 stelian Exp $"; + "$Id: symtab.c,v 1.12 2000/12/21 11:14:54 stelian Exp $"; #endif /* not lint */ /* @@ -52,6 +53,7 @@ static const char rcsid[] = * are needed, by calling "myname". */ +#include #include #include @@ -245,7 +247,7 @@ addentry(char *name, ino_t inum, int type) } else { np = (struct entry *)calloc(1, sizeof(struct entry)); if (np == NULL) - panic("no memory to extend symbol table\n"); + errx(1, "no memory to extend symbol table"); } np->e_type = type & ~LINK; ep = lookupparent(name); @@ -391,7 +393,7 @@ struct strhdr { #define STRTBLINCR (sizeof(struct strhdr)) #define allocsize(size) (((size) + 1 + STRTBLINCR - 1) & ~(STRTBLINCR - 1)) -static struct strhdr strtblhdr[allocsize(NAME_MAX) / STRTBLINCR]; +static struct strhdr strtblhdr[allocsize(MAXNAMLEN) / STRTBLINCR]; /* * Allocate space for a name. It first looks to see if it already @@ -414,7 +416,7 @@ savename(char *name) } else { cp = malloc((unsigned)allocsize(len)); if (cp == NULL) - panic("no space for string table\n"); + errx(1, "no space for string table"); } (void) strcpy(cp, name); return (cp); @@ -554,27 +556,27 @@ initsymtable(char *filename) entry = (struct entry **) calloc((unsigned)entrytblsize, sizeof(struct entry *)); if (entry == (struct entry **)NULL) - panic("no memory for entry table\n"); + errx(1, "no memory for entry table"); ep = addentry(".", ROOTINO, NODE); ep->e_flags |= NEW; return; } if ((fd = open(filename, O_RDONLY, 0)) < 0) { warn("open"); - panic("cannot open symbol table file %s\n", filename); + errx(1, "cannot open symbol table file %s", filename); } if (fstat(fd, &stbuf) < 0) { warn("stat"); - panic("cannot stat symbol table file %s\n", filename); + errx(1, "cannot stat symbol table file %s", filename); } tblsize = stbuf.st_size - sizeof(struct symtableheader); base = calloc(sizeof(char), (unsigned)tblsize); if (base == NULL) - panic("cannot allocate space for symbol table\n"); + errx(1, "cannot allocate space for symbol table"); if (read(fd, base, (int)tblsize) < 0 || read(fd, (char *)&hdr, sizeof(struct symtableheader)) < 0) { warn("read"); - panic("cannot read symbol table file %s\n", filename); + errx(1, "cannot read symbol table file %s", filename); } switch (command) { case 'r':