]> git.wh0rd.org - dump.git/blob - restore/symtab.c
Fix code to not require ISO C99.
[dump.git] / restore / symtab.c
1 /*
2 * Ported to Linux's Second Extended File System as part of the
3 * dump and restore backup suit
4 * Remy Card <card@Linux.EU.Org>, 1994-1997
5 * Stelian Pop <stelian@popies.net>, 1999-2000
6 * Stelian Pop <stelian@popies.net> - AlcĂ´ve <www.alcove.com>, 2000-2002
7 */
8
9 /*
10 * Copyright (c) 1983, 1993
11 * The Regents of the University of California. All rights reserved.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. Neither the name of the University nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 */
37
38 #ifndef lint
39 static const char rcsid[] =
40 "$Id: symtab.c,v 1.25 2005/03/30 13:34:00 stelian Exp $";
41 #endif /* not lint */
42
43 /*
44 * These routines maintain the symbol table which tracks the state
45 * of the file system being restored. They provide lookup by either
46 * name or inode number. They also provide for creation, deletion,
47 * and renaming of entries. Because of the dynamic nature of pathnames,
48 * names should not be saved, but always constructed just before they
49 * are needed, by calling "myname".
50 */
51
52 #include <config.h>
53 #include <sys/param.h>
54 #include <sys/stat.h>
55
56 #ifdef __linux__
57 #include <sys/time.h>
58 #include <time.h>
59 #ifdef HAVE_EXT2FS_EXT2_FS_H
60 #include <ext2fs/ext2_fs.h>
61 #else
62 #include <linux/ext2_fs.h>
63 #endif
64 #include <bsdcompat.h>
65 #else /* __linux__ */
66 #ifdef sunos
67 #include <sys/fcntl.h>
68 #include <bsdcompat.h>
69 #else
70 #include <ufs/ufs/dinode.h>
71 #endif
72 #endif /* __linux__ */
73
74 #include <errno.h>
75 #include <compaterr.h>
76 #include <fcntl.h>
77 #include <stdio.h>
78 #include <stdlib.h>
79 #include <string.h>
80 #include <unistd.h>
81
82 #ifdef __linux__
83 #include <ext2fs/ext2fs.h>
84 #endif
85
86 #include "restore.h"
87 #include "extern.h"
88
89 /*
90 * The following variables define the inode symbol table.
91 * The primary hash table is dynamically allocated based on
92 * the number of inodes in the file system (maxino), scaled by
93 * HASHFACTOR. The variable "entry" points to the hash table;
94 * the variable "entrytblsize" indicates its size (in entries).
95 */
96 #define HASHFACTOR 5
97 static struct entry **entry;
98 static long entrytblsize;
99
100 static void addino __P((dump_ino_t, struct entry *));
101 static struct entry *lookupparent __P((char *));
102 static void removeentry __P((struct entry *));
103 static int dir_hash __P((char *));
104
105 /*
106 * Returns a hash given a file name
107 */
108 static int
109 dir_hash(char *name)
110 {
111 unsigned long hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9;
112 int len = strlen(name);
113
114 while (len--) {
115 unsigned long hash = hash1 + (hash0 ^ (*name++ * 7152373));
116 if (hash & 0x80000000) hash -= 0x7fffffff;
117 hash1 = hash0;
118 hash0 = hash;
119 }
120 return hash0 % DIRHASH_SIZE;
121 }
122
123 /*
124 * Look up an entry by inode number
125 */
126 struct entry *
127 lookupino(dump_ino_t inum)
128 {
129 struct entry *ep;
130
131 if (inum < WINO || inum >= maxino)
132 return (NULL);
133 for (ep = entry[inum % entrytblsize]; ep != NULL; ep = ep->e_next)
134 if (ep->e_ino == inum)
135 return (ep);
136 return (NULL);
137 }
138
139 /*
140 * Add an entry into the entry table
141 */
142 static void
143 addino(dump_ino_t inum, struct entry *np)
144 {
145 struct entry **epp;
146
147 if (inum < WINO || inum >= maxino)
148 panic("addino: out of range %d\n", inum);
149 epp = &entry[inum % entrytblsize];
150 np->e_ino = inum;
151 np->e_next = *epp;
152 *epp = np;
153 if (dflag)
154 for (np = np->e_next; np != NULL; np = np->e_next)
155 if (np->e_ino == inum)
156 badentry(np, "duplicate inum");
157 }
158
159 /*
160 * Delete an entry from the entry table
161 */
162 void
163 deleteino(dump_ino_t inum)
164 {
165 struct entry *next;
166 struct entry **prev;
167
168 if (inum < WINO || inum >= maxino)
169 panic("deleteino: out of range %d\n", inum);
170 prev = &entry[inum % entrytblsize];
171 for (next = *prev; next != NULL; next = next->e_next) {
172 if (next->e_ino == inum) {
173 next->e_ino = 0;
174 *prev = next->e_next;
175 return;
176 }
177 prev = &next->e_next;
178 }
179 panic("deleteino: %d not found\n", inum);
180 }
181
182 /*
183 * Look up an entry by name
184 */
185 struct entry *
186 lookupname(char *name)
187 {
188 struct entry *ep, *oldep;
189 char *np, *cp;
190 char buf[MAXPATHLEN];
191
192 ep = lookupino(ROOTINO);
193
194 cp = name;
195 if (*cp == '.')
196 ++cp;
197 if (*cp == '/')
198 ++cp;
199 if (*cp == '\0')
200 return ep;
201
202 while (ep != NULL) {
203 for (np = buf; *cp != '/' && *cp != '\0' &&
204 np < &buf[sizeof(buf)]; )
205 *np++ = *cp++;
206 if (np == &buf[sizeof(buf)])
207 break;
208 *np = '\0';
209
210 oldep = ep;
211
212 if (ep->e_entries != NULL) {
213
214 ep = ep->e_entries[dir_hash(buf)];
215 for ( ; ep != NULL; ep = ep->e_sibling)
216 if (strcmp(ep->e_name, buf) == 0)
217 break;
218
219 /* search all hash lists for renamed inodes */
220 if (ep == NULL) {
221 int j;
222 for (j = 0; j < DIRHASH_SIZE; j++) {
223 ep = oldep->e_entries[j];
224 for ( ; ep != NULL; ep = ep->e_sibling)
225 if (strcmp(ep->e_name, buf) == 0)
226 break;
227 if (ep != NULL)
228 break;
229 }
230 }
231 }
232
233 if (ep == NULL)
234 break;
235 if (*cp++ == '\0')
236 return (ep);
237 }
238 return (NULL);
239 }
240
241 /*
242 * Look up the parent of a pathname
243 */
244 static struct entry *
245 lookupparent(char *name)
246 {
247 struct entry *ep;
248 char *tailindex;
249
250 tailindex = strrchr(name, '/');
251 if (tailindex == NULL)
252 return (NULL);
253 *tailindex = '\0';
254 ep = lookupname(name);
255 *tailindex = '/';
256 if (ep == NULL)
257 return (NULL);
258 if (ep->e_type != NODE)
259 panic("%s is not a directory\n", name);
260 return (ep);
261 }
262
263 /*
264 * Determine the current pathname of a node or leaf
265 */
266 char *
267 myname(struct entry *ep)
268 {
269 char *cp;
270 static char namebuf[MAXPATHLEN];
271
272 for (cp = &namebuf[MAXPATHLEN - 2]; cp > &namebuf[ep->e_namlen]; ) {
273 cp -= ep->e_namlen;
274 memmove(cp, ep->e_name, (size_t)ep->e_namlen);
275 if (ep == lookupino(ROOTINO))
276 return (cp);
277 *(--cp) = '/';
278 ep = ep->e_parent;
279 }
280 panic("%s: pathname too long\n", cp);
281 return(cp);
282 }
283
284 /*
285 * Unused symbol table entries are linked together on a free list
286 * headed by the following pointer.
287 */
288 static struct entry *freelist = NULL;
289
290 /*
291 * add an entry to the symbol table
292 */
293 struct entry *
294 addentry(char *name, dump_ino_t inum, int type)
295 {
296 struct entry *np, *ep;
297
298 if (freelist != NULL) {
299 np = freelist;
300 freelist = np->e_next;
301 memset(np, 0, sizeof(struct entry));
302 } else {
303 np = (struct entry *)calloc(1, sizeof(struct entry));
304 if (np == NULL)
305 errx(1, "no memory to extend symbol table");
306 }
307 np->e_type = type & ~LINK;
308 if (type & NODE) {
309 np->e_entries = calloc(1, DIRHASH_SIZE * sizeof(struct entry *));
310 if (np->e_entries == NULL)
311 panic("unable to allocate directory entries\n");
312 }
313 ep = lookupparent(name);
314 if (ep == NULL) {
315 if (inum != ROOTINO || lookupino(ROOTINO) != NULL)
316 panic("bad name to addentry %s\n", name);
317 np->e_name = savename(name);
318 np->e_namlen = strlen(name);
319 np->e_parent = np;
320 addino(ROOTINO, np);
321 return (np);
322 }
323 np->e_name = savename(strrchr(name, '/') + 1);
324 np->e_namlen = strlen(np->e_name);
325 np->e_parent = ep;
326 np->e_sibling = ep->e_entries[dir_hash(np->e_name)];
327 ep->e_entries[dir_hash(np->e_name)] = np;
328 if (type & LINK) {
329 ep = lookupino(inum);
330 if (ep == NULL)
331 panic("link to non-existent name\n");
332 np->e_ino = inum;
333 np->e_links = ep->e_links;
334 ep->e_links = np;
335 } else if (inum != 0) {
336 if (lookupino(inum) != NULL)
337 panic("duplicate entry\n");
338 addino(inum, np);
339 }
340 return (np);
341 }
342
343 /*
344 * delete an entry from the symbol table
345 */
346 void
347 freeentry(struct entry *ep)
348 {
349 struct entry *np;
350 dump_ino_t inum;
351
352 if (ep->e_flags != REMOVED)
353 badentry(ep, "not marked REMOVED");
354 if (ep->e_type == NODE) {
355 if (ep->e_links != NULL)
356 badentry(ep, "freeing referenced directory");
357 if (ep->e_entries != NULL) {
358 int i;
359 for (i = 0; i < DIRHASH_SIZE; i++) {
360 if (ep->e_entries[i] != NULL)
361 badentry(ep, "freeing non-empty directory");
362 }
363 }
364 }
365 if (ep->e_ino != 0) {
366 np = lookupino(ep->e_ino);
367 if (np == NULL)
368 badentry(ep, "lookupino failed");
369 if (np == ep) {
370 inum = ep->e_ino;
371 deleteino(inum);
372 if (ep->e_links != NULL)
373 addino(inum, ep->e_links);
374 } else {
375 for (; np != NULL; np = np->e_links) {
376 if (np->e_links == ep) {
377 np->e_links = ep->e_links;
378 break;
379 }
380 }
381 if (np == NULL)
382 badentry(ep, "link not found");
383 }
384 }
385 removeentry(ep);
386 freename(ep->e_name);
387 ep->e_next = freelist;
388 freelist = ep;
389 }
390
391 /*
392 * Relocate an entry in the tree structure
393 */
394 void
395 moveentry(struct entry *ep, char *newname)
396 {
397 struct entry *np;
398 char *cp;
399
400 np = lookupparent(newname);
401 if (np == NULL)
402 badentry(ep, "cannot move ROOT");
403 if (np != ep->e_parent) {
404 removeentry(ep);
405 ep->e_parent = np;
406 ep->e_sibling = np->e_entries[dir_hash(ep->e_name)];
407 np->e_entries[dir_hash(ep->e_name)] = ep;
408 }
409 cp = strrchr(newname, '/') + 1;
410 freename(ep->e_name);
411 ep->e_name = savename(cp);
412 ep->e_namlen = strlen(cp);
413 if (strcmp(gentempname(ep), ep->e_name) == 0)
414 ep->e_flags |= TMPNAME;
415 else
416 ep->e_flags &= ~TMPNAME;
417 }
418
419 /*
420 * Remove an entry in the tree structure
421 */
422 static void
423 removeentry(struct entry *ep)
424 {
425 struct entry *np = ep->e_parent;
426 struct entry *entry = np->e_entries[dir_hash(ep->e_name)];
427
428 if (entry == ep) {
429 np->e_entries[dir_hash(ep->e_name)] = ep->e_sibling;
430 } else {
431 for (np = entry; np != NULL; np = np->e_sibling) {
432 if (np->e_sibling == ep) {
433 np->e_sibling = ep->e_sibling;
434 break;
435 }
436 }
437 if (np == NULL) {
438
439 /* search all hash lists for renamed inodes */
440 int j;
441 for (j = 0; j < DIRHASH_SIZE; j++) {
442 np = ep->e_parent;
443 entry = np->e_entries[j];
444 if (entry == ep) {
445 np->e_entries[j] = ep->e_sibling;
446 return;
447 }
448 else {
449 for (np = entry; np != NULL; np = np->e_sibling) {
450 if (np->e_sibling == ep) {
451 np->e_sibling = ep->e_sibling;
452 return;
453 }
454 }
455 }
456 }
457 badentry(ep, "cannot find entry in parent list");
458 }
459 }
460 }
461
462 /*
463 * Table of unused string entries, sorted by length.
464 *
465 * Entries are allocated in STRTBLINCR sized pieces so that names
466 * of similar lengths can use the same entry. The value of STRTBLINCR
467 * is chosen so that every entry has at least enough space to hold
468 * a "struct strtbl" header. Thus every entry can be linked onto an
469 * appropriate free list.
470 *
471 * NB. The macro "allocsize" below assumes that "struct strhdr"
472 * has a size that is a power of two.
473 */
474 struct strhdr {
475 struct strhdr *next;
476 };
477
478 #define STRTBLINCR (sizeof(struct strhdr))
479 #define allocsize(size) (((size) + 1 + STRTBLINCR - 1) & ~(STRTBLINCR - 1))
480
481 static struct strhdr strtblhdr[allocsize(MAXNAMLEN) / STRTBLINCR];
482
483 /*
484 * Allocate space for a name. It first looks to see if it already
485 * has an appropriate sized entry, and if not allocates a new one.
486 */
487 char *
488 savename(char *name)
489 {
490 struct strhdr *np;
491 long len;
492 char *cp;
493
494 if (name == NULL)
495 panic("bad name\n");
496 len = strlen(name);
497 np = strtblhdr[len / STRTBLINCR].next;
498 if (np != NULL) {
499 strtblhdr[len / STRTBLINCR].next = np->next;
500 cp = (char *)np;
501 } else {
502 cp = malloc((unsigned)allocsize(len));
503 if (cp == NULL)
504 errx(1, "no space for string table");
505 }
506 (void) strcpy(cp, name);
507 return (cp);
508 }
509
510 /*
511 * Free space for a name. The resulting entry is linked onto the
512 * appropriate free list.
513 */
514 void
515 freename(char *name)
516 {
517 struct strhdr *tp, *np;
518
519 tp = &strtblhdr[strlen(name) / STRTBLINCR];
520 np = (struct strhdr *)name;
521 np->next = tp->next;
522 tp->next = np;
523 }
524
525 /*
526 * Useful quantities placed at the end of a dumped symbol table.
527 */
528 struct symtableheader {
529 int32_t volno;
530 int32_t stringsize;
531 int32_t hashsize;
532 int32_t entrytblsize;
533 time_t dumptime;
534 time_t dumpdate;
535 dump_ino_t maxino;
536 int32_t ntrec;
537 int32_t zflag;
538 };
539
540 /*
541 * dump a snapshot of the symbol table
542 */
543 void
544 dumpsymtable(char *filename, long checkpt)
545 {
546 struct entry *ep, *tep;
547 dump_ino_t i;
548 struct entry temp, *tentry;
549 long mynum = 1, stroff = 0, hashoff = 0;
550 FILE *fd;
551 struct symtableheader hdr;
552 struct entry *temphash[DIRHASH_SIZE];
553
554 Vprintf(stdout, "Check pointing the restore\n");
555 if (Nflag)
556 return;
557 if ((fd = fopen(filename, "w")) == NULL) {
558 warn("fopen");
559 panic("cannot create save file %s for symbol table\n",
560 filename);
561 }
562 clearerr(fd);
563 /*
564 * Assign indices to each entry
565 * Write out the string entries
566 */
567 for (i = WINO; i <= maxino; i++) {
568 for (ep = lookupino(i); ep != NULL; ep = ep->e_links) {
569 ep->e_index = mynum++;
570 (void) fwrite(ep->e_name, sizeof(char),
571 (int)allocsize(ep->e_namlen), fd);
572 }
573 }
574 /*
575 * Write out e_entries tables
576 */
577 for (i = WINO; i <= maxino; i++) {
578 for (ep = lookupino(i); ep != NULL; ep = ep->e_links) {
579 if (ep->e_entries != NULL) {
580 int j;
581 memcpy(temphash, ep->e_entries, DIRHASH_SIZE * sizeof(struct entry *));
582 for (j = 0; j < DIRHASH_SIZE; j++) {
583 if (temphash[j])
584 temphash[j] = (struct entry *)ep->e_entries[j]->e_index;
585 }
586 fwrite(temphash, DIRHASH_SIZE, sizeof(struct entry *), fd);
587 }
588 }
589 }
590 /*
591 * Convert pointers to indexes, and output
592 */
593 tep = &temp;
594 stroff = 0;
595 hashoff = 0;
596 for (i = WINO; i <= maxino; i++) {
597 for (ep = lookupino(i); ep != NULL; ep = ep->e_links) {
598 memmove(tep, ep, sizeof(struct entry));
599 tep->e_name = (char *)stroff;
600 stroff += allocsize(ep->e_namlen);
601 tep->e_parent = (struct entry *)ep->e_parent->e_index;
602 if (ep->e_links != NULL)
603 tep->e_links =
604 (struct entry *)ep->e_links->e_index;
605 if (ep->e_sibling != NULL)
606 tep->e_sibling =
607 (struct entry *)ep->e_sibling->e_index;
608 if (ep->e_entries != NULL) {
609 tep->e_entries = (struct entry **)hashoff;
610 hashoff += DIRHASH_SIZE * sizeof(struct entry *);
611 }
612 if (ep->e_next != NULL)
613 tep->e_next =
614 (struct entry *)ep->e_next->e_index;
615 (void) fwrite((char *)tep, sizeof(struct entry), 1, fd);
616 }
617 }
618 /*
619 * Convert entry pointers to indexes, and output
620 */
621 for (i = 0; (long)i < entrytblsize; i++) {
622 if (entry[i] == NULL)
623 tentry = NULL;
624 else
625 tentry = (struct entry *)entry[i]->e_index;
626 (void) fwrite((char *)&tentry, sizeof(struct entry *), 1, fd);
627 }
628 hdr.volno = checkpt;
629 hdr.maxino = maxino;
630 hdr.entrytblsize = entrytblsize;
631 hdr.stringsize = stroff;
632 hdr.hashsize = hashoff;
633 hdr.dumptime = dumptime;
634 hdr.dumpdate = dumpdate;
635 hdr.ntrec = ntrec;
636 hdr.zflag = zflag;
637 (void) fwrite((char *)&hdr, sizeof(struct symtableheader), 1, fd);
638 if (ferror(fd)) {
639 warn("fwrite");
640 panic("output error to file %s writing symbol table\n",
641 filename);
642 }
643 (void) fclose(fd);
644 }
645
646 /*
647 * Initialize a symbol table from a file
648 */
649 void
650 initsymtable(char *filename)
651 {
652 char *base;
653 long tblsize;
654 struct entry *ep;
655 struct entry *baseep, *lep;
656 struct symtableheader hdr;
657 struct stat stbuf;
658 long i;
659 int fd;
660
661 Vprintf(stdout, "Initialize symbol table.\n");
662 if (filename == NULL) {
663 entrytblsize = maxino / HASHFACTOR;
664 entry = (struct entry **)
665 calloc((unsigned)entrytblsize, sizeof(struct entry *));
666 if (entry == (struct entry **)NULL)
667 errx(1, "no memory for entry table");
668 ep = addentry(".", ROOTINO, NODE);
669 ep->e_flags |= NEW;
670 return;
671 }
672 if ((fd = open(filename, O_RDONLY, 0)) < 0) {
673 warn("open");
674 errx(1, "cannot open symbol table file %s", filename);
675 }
676 if (fstat(fd, &stbuf) < 0) {
677 warn("stat");
678 errx(1, "cannot stat symbol table file %s", filename);
679 }
680 tblsize = stbuf.st_size - sizeof(struct symtableheader);
681 base = calloc(sizeof(char), (unsigned)tblsize);
682 if (base == NULL)
683 errx(1, "cannot allocate space for symbol table");
684 if (read(fd, base, (int)tblsize) < 0 ||
685 read(fd, (char *)&hdr, sizeof(struct symtableheader)) < 0) {
686 warn("read");
687 errx(1, "cannot read symbol table file %s", filename);
688 }
689 switch (command) {
690 case 'r':
691 /*
692 * For normal continuation, insure that we are using
693 * the next incremental tape
694 */
695 if (hdr.dumpdate != dumptime)
696 errx(1, "Incremental tape too %s",
697 (hdr.dumpdate < dumptime) ? "low" : "high");
698 break;
699 case 'R':
700 /*
701 * For restart, insure that we are using the same tape
702 */
703 curfile.action = SKIP;
704 dumptime = hdr.dumptime;
705 dumpdate = hdr.dumpdate;
706 zflag = hdr.zflag;
707 if (!bflag)
708 newtapebuf(hdr.ntrec);
709 getvol(hdr.volno);
710 break;
711 default:
712 panic("initsymtable called from command %c\n", command);
713 break;
714 }
715 if (hdr.maxino > maxino) {
716 resizemaps(maxino, hdr.maxino);
717 maxino = hdr.maxino;
718 }
719 entrytblsize = hdr.entrytblsize;
720 entry = (struct entry **)
721 (base + tblsize - (entrytblsize * sizeof(struct entry *)));
722 baseep = (struct entry *)(base + hdr.stringsize + hdr.hashsize - sizeof(struct entry));
723 lep = (struct entry *)entry;
724 for (i = 0; i < entrytblsize; i++) {
725 if (entry[i] == NULL)
726 continue;
727 entry[i] = &baseep[(long)entry[i]];
728 }
729 for (ep = &baseep[1]; ep < lep; ep++) {
730 ep->e_name = base + (long)ep->e_name;
731 ep->e_parent = &baseep[(long)ep->e_parent];
732 if (ep->e_sibling != NULL)
733 ep->e_sibling = &baseep[(long)ep->e_sibling];
734 if (ep->e_links != NULL)
735 ep->e_links = &baseep[(long)ep->e_links];
736 if (ep->e_type == NODE) {
737 int i;
738 ep->e_entries = (struct entry **)(base + hdr.stringsize + (long)ep->e_entries);
739 for (i = 0; i < DIRHASH_SIZE; i++) {
740 if (ep->e_entries[i])
741 ep->e_entries[i] = &baseep[(long)ep->e_entries[i]];
742 }
743 }
744 else
745 ep->e_entries = NULL;
746 if (ep->e_next != NULL)
747 ep->e_next = &baseep[(long)ep->e_next];
748 }
749 }