dirs.c revision 144099
1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 4. Neither the name of the University nor the names of its contributors 19 * may be used to endorse or promote products derived from this software 20 * without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 */ 34 35#ifndef lint 36#if 0 37static char sccsid[] = "@(#)dirs.c 8.7 (Berkeley) 5/1/95"; 38#endif 39static const char rcsid[] = 40 "$FreeBSD: head/sbin/restore/dirs.c 144099 2005-03-25 07:35:59Z imp $"; 41#endif /* not lint */ 42 43#include <sys/param.h> 44#include <sys/file.h> 45#include <sys/stat.h> 46#include <sys/time.h> 47 48#include <ufs/ufs/dinode.h> 49#include <ufs/ufs/dir.h> 50#include <protocols/dumprestore.h> 51 52#include <err.h> 53#include <errno.h> 54#include <limits.h> 55#include <paths.h> 56#include <stdio.h> 57#include <stdlib.h> 58#include <string.h> 59#include <unistd.h> 60 61#include "restore.h" 62#include "extern.h" 63 64/* 65 * Symbol table of directories read from tape. 66 */ 67#define HASHSIZE 1000 68#define INOHASH(val) (val % HASHSIZE) 69struct inotab { 70 struct inotab *t_next; 71 ino_t t_ino; 72 int32_t t_seekpt; 73 int32_t t_size; 74}; 75static struct inotab *inotab[HASHSIZE]; 76 77/* 78 * Information retained about directories. 79 */ 80struct modeinfo { 81 ino_t ino; 82 struct timeval ctimep[2]; 83 struct timeval mtimep[2]; 84 mode_t mode; 85 uid_t uid; 86 gid_t gid; 87 int flags; 88}; 89 90/* 91 * Definitions for library routines operating on directories. 92 */ 93#undef DIRBLKSIZ 94#define DIRBLKSIZ 1024 95struct rstdirdesc { 96 int dd_fd; 97 int32_t dd_loc; 98 int32_t dd_size; 99 char dd_buf[DIRBLKSIZ]; 100}; 101 102/* 103 * Global variables for this file. 104 */ 105static long seekpt; 106static FILE *df, *mf; 107static RST_DIR *dirp; 108static char dirfile[MAXPATHLEN] = "#"; /* No file */ 109static char modefile[MAXPATHLEN] = "#"; /* No file */ 110static char dot[2] = "."; /* So it can be modified */ 111 112static struct inotab *allocinotab(struct context *, long); 113static void flushent(void); 114static struct inotab *inotablookup(ino_t); 115static RST_DIR *opendirfile(const char *); 116static void putdir(char *, long); 117static void putent(struct direct *); 118static void rst_seekdir(RST_DIR *, long, long); 119static long rst_telldir(RST_DIR *); 120static struct direct *searchdir(ino_t, char *); 121 122/* 123 * Extract directory contents, building up a directory structure 124 * on disk for extraction by name. 125 * If genmode is requested, save mode, owner, and times for all 126 * directories on the tape. 127 */ 128void 129extractdirs(int genmode) 130{ 131 struct inotab *itp; 132 struct direct nulldir; 133 int i, fd; 134 const char *tmpdir; 135 136 vprintf(stdout, "Extract directories from tape\n"); 137 if ((tmpdir = getenv("TMPDIR")) == NULL || tmpdir[0] == '\0') 138 tmpdir = _PATH_TMP; 139 (void) sprintf(dirfile, "%s/rstdir%d", tmpdir, dumpdate); 140 if (command != 'r' && command != 'R') { 141 (void *) strcat(dirfile, "-XXXXXX"); 142 fd = mkstemp(dirfile); 143 } else 144 fd = open(dirfile, O_RDWR|O_CREAT|O_EXCL, 0666); 145 if (fd == -1 || (df = fdopen(fd, "w")) == NULL) { 146 if (fd != -1) 147 close(fd); 148 warn("%s - cannot create directory temporary\nfopen", dirfile); 149 done(1); 150 } 151 if (genmode != 0) { 152 (void) sprintf(modefile, "%s/rstmode%d", tmpdir, dumpdate); 153 if (command != 'r' && command != 'R') { 154 (void *) strcat(modefile, "-XXXXXX"); 155 fd = mkstemp(modefile); 156 } else 157 fd = open(modefile, O_RDWR|O_CREAT|O_EXCL, 0666); 158 if (fd == -1 || (mf = fdopen(fd, "w")) == NULL) { 159 if (fd != -1) 160 close(fd); 161 warn("%s - cannot create modefile\nfopen", modefile); 162 done(1); 163 } 164 } 165 nulldir.d_ino = 0; 166 nulldir.d_type = DT_DIR; 167 nulldir.d_namlen = 1; 168 (void) strcpy(nulldir.d_name, "/"); 169 nulldir.d_reclen = DIRSIZ(0, &nulldir); 170 for (;;) { 171 curfile.name = "<directory file - name unknown>"; 172 curfile.action = USING; 173 if (curfile.mode == 0 || (curfile.mode & IFMT) != IFDIR) { 174 (void) fclose(df); 175 dirp = opendirfile(dirfile); 176 if (dirp == NULL) 177 fprintf(stderr, "opendirfile: %s\n", 178 strerror(errno)); 179 if (mf != NULL) 180 (void) fclose(mf); 181 i = dirlookup(dot); 182 if (i == 0) 183 panic("Root directory is not on tape\n"); 184 return; 185 } 186 itp = allocinotab(&curfile, seekpt); 187 getfile(putdir, xtrnull); 188 putent(&nulldir); 189 flushent(); 190 itp->t_size = seekpt - itp->t_seekpt; 191 } 192} 193 194/* 195 * skip over all the directories on the tape 196 */ 197void 198skipdirs(void) 199{ 200 201 while (curfile.ino && (curfile.mode & IFMT) == IFDIR) { 202 skipfile(); 203 } 204} 205 206/* 207 * Recursively find names and inumbers of all files in subtree 208 * pname and pass them off to be processed. 209 */ 210void 211treescan(char *pname, ino_t ino, long (*todo)(char *, ino_t, int)) 212{ 213 struct inotab *itp; 214 struct direct *dp; 215 int namelen; 216 long bpt; 217 char locname[MAXPATHLEN + 1]; 218 219 itp = inotablookup(ino); 220 if (itp == NULL) { 221 /* 222 * Pname is name of a simple file or an unchanged directory. 223 */ 224 (void) (*todo)(pname, ino, LEAF); 225 return; 226 } 227 /* 228 * Pname is a dumped directory name. 229 */ 230 if ((*todo)(pname, ino, NODE) == FAIL) 231 return; 232 /* 233 * begin search through the directory 234 * skipping over "." and ".." 235 */ 236 (void) strncpy(locname, pname, sizeof(locname) - 1); 237 locname[sizeof(locname) - 1] = '\0'; 238 (void) strncat(locname, "/", sizeof(locname) - strlen(locname)); 239 namelen = strlen(locname); 240 rst_seekdir(dirp, itp->t_seekpt, itp->t_seekpt); 241 dp = rst_readdir(dirp); /* "." */ 242 if (dp != NULL && strcmp(dp->d_name, ".") == 0) 243 dp = rst_readdir(dirp); /* ".." */ 244 else 245 fprintf(stderr, "Warning: `.' missing from directory %s\n", 246 pname); 247 if (dp != NULL && strcmp(dp->d_name, "..") == 0) 248 dp = rst_readdir(dirp); /* first real entry */ 249 else 250 fprintf(stderr, "Warning: `..' missing from directory %s\n", 251 pname); 252 bpt = rst_telldir(dirp); 253 /* 254 * a zero inode signals end of directory 255 */ 256 while (dp != NULL) { 257 locname[namelen] = '\0'; 258 if (namelen + dp->d_namlen >= sizeof(locname)) { 259 fprintf(stderr, "%s%s: name exceeds %d char\n", 260 locname, dp->d_name, sizeof(locname) - 1); 261 } else { 262 (void) strncat(locname, dp->d_name, (int)dp->d_namlen); 263 treescan(locname, dp->d_ino, todo); 264 rst_seekdir(dirp, bpt, itp->t_seekpt); 265 } 266 dp = rst_readdir(dirp); 267 bpt = rst_telldir(dirp); 268 } 269} 270 271/* 272 * Lookup a pathname which is always assumed to start from the ROOTINO. 273 */ 274struct direct * 275pathsearch(const char *pathname) 276{ 277 ino_t ino; 278 struct direct *dp; 279 char *path, *name, buffer[MAXPATHLEN]; 280 281 printf("Looking for %s\n", pathname); 282 283 strcpy(buffer, pathname); 284 path = buffer; 285 ino = ROOTINO; 286 while (*path == '/') 287 path++; 288 dp = NULL; 289 while ((name = strsep(&path, "/")) != NULL && *name != '\0') { 290 if ((dp = searchdir(ino, name)) == NULL) 291 return (NULL); 292 ino = dp->d_ino; 293 } 294 return (dp); 295} 296 297/* 298 * Lookup the requested name in directory inum. 299 * Return its inode number if found, zero if it does not exist. 300 */ 301static struct direct * 302searchdir(ino_t inum, char *name) 303{ 304 struct direct *dp; 305 struct inotab *itp; 306 int len; 307 308 itp = inotablookup(inum); 309 if (itp == NULL) 310 return (NULL); 311 rst_seekdir(dirp, itp->t_seekpt, itp->t_seekpt); 312 len = strlen(name); 313 do { 314 dp = rst_readdir(dirp); 315 if (dp == NULL) 316 return (NULL); 317 } while (dp->d_namlen != len || strncmp(dp->d_name, name, len) != 0); 318 return (dp); 319} 320 321/* 322 * Put the directory entries in the directory file 323 */ 324static void 325putdir(char *buf, long size) 326{ 327 struct direct *dp; 328 long loc, i; 329 330 for (loc = 0; loc < size; ) { 331 dp = (struct direct *)(buf + loc); 332 if (Bcvt) 333 swabst((u_char *)"ls", (u_char *) dp); 334 if (oldinofmt && dp->d_ino != 0) { 335#if BYTE_ORDER == BIG_ENDIAN 336 if (Bcvt) 337 dp->d_namlen = dp->d_type; 338#else 339 if (!Bcvt && dp->d_namlen == 0) 340 dp->d_namlen = dp->d_type; 341#endif 342 dp->d_type = DT_UNKNOWN; 343 } 344 i = DIRBLKSIZ - (loc & (DIRBLKSIZ - 1)); 345 if ((dp->d_reclen & 0x3) != 0 || 346 dp->d_reclen > i || 347 dp->d_reclen < DIRSIZ(0, dp) 348#if NAME_MAX < 255 349 || dp->d_namlen > NAME_MAX 350#endif 351 ) { 352 vprintf(stdout, "Mangled directory: "); 353 if ((dp->d_reclen & 0x3) != 0) 354 vprintf(stdout, 355 "reclen not multiple of 4 "); 356 if (dp->d_reclen < DIRSIZ(0, dp)) 357 vprintf(stdout, 358 "reclen less than DIRSIZ (%d < %d) ", 359 dp->d_reclen, DIRSIZ(0, dp)); 360#if NAME_MAX < 255 361 if (dp->d_namlen > NAME_MAX) 362 vprintf(stdout, 363 "reclen name too big (%d > %d) ", 364 dp->d_namlen, NAME_MAX); 365#endif 366 vprintf(stdout, "\n"); 367 loc += i; 368 continue; 369 } 370 loc += dp->d_reclen; 371 if (dp->d_ino != 0) { 372 putent(dp); 373 } 374 } 375} 376 377/* 378 * These variables are "local" to the following two functions. 379 */ 380char dirbuf[DIRBLKSIZ]; 381long dirloc = 0; 382long prev = 0; 383 384/* 385 * add a new directory entry to a file. 386 */ 387static void 388putent(struct direct *dp) 389{ 390 dp->d_reclen = DIRSIZ(0, dp); 391 if (dirloc + dp->d_reclen > DIRBLKSIZ) { 392 ((struct direct *)(dirbuf + prev))->d_reclen = 393 DIRBLKSIZ - prev; 394 (void) fwrite(dirbuf, 1, DIRBLKSIZ, df); 395 dirloc = 0; 396 } 397 memmove(dirbuf + dirloc, dp, (long)dp->d_reclen); 398 prev = dirloc; 399 dirloc += dp->d_reclen; 400} 401 402/* 403 * flush out a directory that is finished. 404 */ 405static void 406flushent(void) 407{ 408 ((struct direct *)(dirbuf + prev))->d_reclen = DIRBLKSIZ - prev; 409 (void) fwrite(dirbuf, (int)dirloc, 1, df); 410 seekpt = ftell(df); 411 dirloc = 0; 412} 413 414/* 415 * Seek to an entry in a directory. 416 * Only values returned by rst_telldir should be passed to rst_seekdir. 417 * This routine handles many directories in a single file. 418 * It takes the base of the directory in the file, plus 419 * the desired seek offset into it. 420 */ 421static void 422rst_seekdir(RST_DIR *dirp, long loc, long base) 423{ 424 425 if (loc == rst_telldir(dirp)) 426 return; 427 loc -= base; 428 if (loc < 0) 429 fprintf(stderr, "bad seek pointer to rst_seekdir %ld\n", loc); 430 (void) lseek(dirp->dd_fd, base + (loc & ~(DIRBLKSIZ - 1)), SEEK_SET); 431 dirp->dd_loc = loc & (DIRBLKSIZ - 1); 432 if (dirp->dd_loc != 0) 433 dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf, DIRBLKSIZ); 434} 435 436/* 437 * get next entry in a directory. 438 */ 439struct direct * 440rst_readdir(RST_DIR *dirp) 441{ 442 struct direct *dp; 443 444 for (;;) { 445 if (dirp->dd_loc == 0) { 446 dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf, 447 DIRBLKSIZ); 448 if (dirp->dd_size <= 0) { 449 dprintf(stderr, "error reading directory\n"); 450 return (NULL); 451 } 452 } 453 if (dirp->dd_loc >= dirp->dd_size) { 454 dirp->dd_loc = 0; 455 continue; 456 } 457 dp = (struct direct *)(dirp->dd_buf + dirp->dd_loc); 458 if (dp->d_reclen == 0 || 459 dp->d_reclen > DIRBLKSIZ + 1 - dirp->dd_loc) { 460 dprintf(stderr, "corrupted directory: bad reclen %d\n", 461 dp->d_reclen); 462 return (NULL); 463 } 464 dirp->dd_loc += dp->d_reclen; 465 if (dp->d_ino == 0 && strcmp(dp->d_name, "/") == 0) 466 return (NULL); 467 if (dp->d_ino >= maxino) { 468 dprintf(stderr, "corrupted directory: bad inum %d\n", 469 dp->d_ino); 470 continue; 471 } 472 return (dp); 473 } 474} 475 476/* 477 * Simulate the opening of a directory 478 */ 479void * 480rst_opendir(const char *name) 481{ 482 struct inotab *itp; 483 RST_DIR *dirp; 484 ino_t ino; 485 486 if ((ino = dirlookup(name)) > 0 && 487 (itp = inotablookup(ino)) != NULL) { 488 dirp = opendirfile(dirfile); 489 rst_seekdir(dirp, itp->t_seekpt, itp->t_seekpt); 490 return (dirp); 491 } 492 return (NULL); 493} 494 495/* 496 * In our case, there is nothing to do when closing a directory. 497 */ 498void 499rst_closedir(void *arg) 500{ 501 RST_DIR *dirp; 502 503 dirp = arg; 504 (void)close(dirp->dd_fd); 505 free(dirp); 506 return; 507} 508 509/* 510 * Simulate finding the current offset in the directory. 511 */ 512static long 513rst_telldir(RST_DIR *dirp) 514{ 515 return ((long)lseek(dirp->dd_fd, 516 (off_t)0, SEEK_CUR) - dirp->dd_size + dirp->dd_loc); 517} 518 519/* 520 * Open a directory file. 521 */ 522static RST_DIR * 523opendirfile(const char *name) 524{ 525 RST_DIR *dirp; 526 int fd; 527 528 if ((fd = open(name, O_RDONLY)) == -1) 529 return (NULL); 530 if ((dirp = malloc(sizeof(RST_DIR))) == NULL) { 531 (void)close(fd); 532 return (NULL); 533 } 534 dirp->dd_fd = fd; 535 dirp->dd_loc = 0; 536 return (dirp); 537} 538 539/* 540 * Set the mode, owner, and times for all new or changed directories 541 */ 542void 543setdirmodes(int flags) 544{ 545 FILE *mf; 546 struct modeinfo node; 547 struct entry *ep; 548 char *cp; 549 const char *tmpdir; 550 551 vprintf(stdout, "Set directory mode, owner, and times.\n"); 552 if ((tmpdir = getenv("TMPDIR")) == NULL || tmpdir[0] == '\0') 553 tmpdir = _PATH_TMP; 554 if (command == 'r' || command == 'R') 555 (void) sprintf(modefile, "%s/rstmode%d", tmpdir, dumpdate); 556 if (modefile[0] == '#') { 557 panic("modefile not defined\n"); 558 fprintf(stderr, "directory mode, owner, and times not set\n"); 559 return; 560 } 561 mf = fopen(modefile, "r"); 562 if (mf == NULL) { 563 fprintf(stderr, "fopen: %s\n", strerror(errno)); 564 fprintf(stderr, "cannot open mode file %s\n", modefile); 565 fprintf(stderr, "directory mode, owner, and times not set\n"); 566 return; 567 } 568 clearerr(mf); 569 for (;;) { 570 (void) fread((char *)&node, 1, sizeof(struct modeinfo), mf); 571 if (feof(mf)) 572 break; 573 ep = lookupino(node.ino); 574 if (command == 'i' || command == 'x') { 575 if (ep == NULL) 576 continue; 577 if ((flags & FORCE) == 0 && ep->e_flags & EXISTED) { 578 ep->e_flags &= ~NEW; 579 continue; 580 } 581 if (node.ino == ROOTINO && 582 reply("set owner/mode for '.'") == FAIL) 583 continue; 584 } 585 if (ep == NULL) { 586 panic("cannot find directory inode %d\n", node.ino); 587 } else { 588 cp = myname(ep); 589 if (!Nflag) { 590 (void) chown(cp, node.uid, node.gid); 591 (void) chmod(cp, node.mode); 592 utimes(cp, node.ctimep); 593 utimes(cp, node.mtimep); 594 (void) chflags(cp, node.flags); 595 } 596 ep->e_flags &= ~NEW; 597 } 598 } 599 if (ferror(mf)) 600 panic("error setting directory modes\n"); 601 (void) fclose(mf); 602} 603 604/* 605 * Generate a literal copy of a directory. 606 */ 607int 608genliteraldir(char *name, ino_t ino) 609{ 610 struct inotab *itp; 611 int ofile, dp, i, size; 612 char buf[BUFSIZ]; 613 614 itp = inotablookup(ino); 615 if (itp == NULL) 616 panic("Cannot find directory inode %d named %s\n", ino, name); 617 if ((ofile = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) { 618 fprintf(stderr, "%s: ", name); 619 (void) fflush(stderr); 620 fprintf(stderr, "cannot create file: %s\n", strerror(errno)); 621 return (FAIL); 622 } 623 rst_seekdir(dirp, itp->t_seekpt, itp->t_seekpt); 624 dp = dup(dirp->dd_fd); 625 for (i = itp->t_size; i > 0; i -= BUFSIZ) { 626 size = i < BUFSIZ ? i : BUFSIZ; 627 if (read(dp, buf, (int) size) == -1) { 628 fprintf(stderr, 629 "write error extracting inode %d, name %s\n", 630 curfile.ino, curfile.name); 631 fprintf(stderr, "read: %s\n", strerror(errno)); 632 done(1); 633 } 634 if (!Nflag && write(ofile, buf, (int) size) == -1) { 635 fprintf(stderr, 636 "write error extracting inode %d, name %s\n", 637 curfile.ino, curfile.name); 638 fprintf(stderr, "write: %s\n", strerror(errno)); 639 done(1); 640 } 641 } 642 (void) close(dp); 643 (void) close(ofile); 644 return (GOOD); 645} 646 647/* 648 * Determine the type of an inode 649 */ 650int 651inodetype(ino_t ino) 652{ 653 struct inotab *itp; 654 655 itp = inotablookup(ino); 656 if (itp == NULL) 657 return (LEAF); 658 return (NODE); 659} 660 661/* 662 * Allocate and initialize a directory inode entry. 663 * If requested, save its pertinent mode, owner, and time info. 664 */ 665static struct inotab * 666allocinotab(struct context *ctxp, long seekpt) 667{ 668 struct inotab *itp; 669 struct modeinfo node; 670 671 itp = calloc(1, sizeof(struct inotab)); 672 if (itp == NULL) 673 panic("no memory directory table\n"); 674 itp->t_next = inotab[INOHASH(ctxp->ino)]; 675 inotab[INOHASH(ctxp->ino)] = itp; 676 itp->t_ino = ctxp->ino; 677 itp->t_seekpt = seekpt; 678 if (mf == NULL) 679 return (itp); 680 node.ino = ctxp->ino; 681 node.mtimep[0].tv_sec = ctxp->atime_sec; 682 node.mtimep[0].tv_usec = ctxp->atime_nsec / 1000; 683 node.mtimep[1].tv_sec = ctxp->mtime_sec; 684 node.mtimep[1].tv_usec = ctxp->mtime_nsec / 1000; 685 node.ctimep[0].tv_sec = ctxp->atime_sec; 686 node.ctimep[0].tv_usec = ctxp->atime_nsec / 1000; 687 node.ctimep[1].tv_sec = ctxp->birthtime_sec; 688 node.ctimep[1].tv_usec = ctxp->birthtime_nsec / 1000; 689 node.mode = ctxp->mode; 690 node.flags = ctxp->file_flags; 691 node.uid = ctxp->uid; 692 node.gid = ctxp->gid; 693 (void) fwrite((char *)&node, 1, sizeof(struct modeinfo), mf); 694 return (itp); 695} 696 697/* 698 * Look up an inode in the table of directories 699 */ 700static struct inotab * 701inotablookup(ino_t ino) 702{ 703 struct inotab *itp; 704 705 for (itp = inotab[INOHASH(ino)]; itp != NULL; itp = itp->t_next) 706 if (itp->t_ino == ino) 707 return (itp); 708 return (NULL); 709} 710 711/* 712 * Clean up and exit 713 */ 714void 715done(int exitcode) 716{ 717 718 closemt(); 719 if (modefile[0] != '#') 720 (void) unlink(modefile); 721 if (dirfile[0] != '#') 722 (void) unlink(dirfile); 723 exit(exitcode); 724} 725