- sumstatus = 0;
- passno = 1;
- do {
- anygtr = 0;
- if (setfsent() == 0)
- errexit("Can't open checklist file: %s\n", FSTAB);
- while ((fsp = getfsent()) != 0) {
- if (strcmp(fsp->fs_type, FSTAB_RW) &&
- strcmp(fsp->fs_type, FSTAB_RO) &&
- strcmp(fsp->fs_type, FSTAB_RQ))
- continue;
- if (preen == 0 ||
- passno == 1 && fsp->fs_passno == passno) {
- name = blockcheck(fsp->fs_spec);
- if (name != NULL)
- checkfilesys(name);
- else if (preen)
- exit(8);
- } else if (fsp->fs_passno > passno) {
- anygtr = 1;
- } else if (fsp->fs_passno == passno) {
- name = blockcheck(fsp->fs_spec);
- if (name == NULL) {
- pwarn("BAD DISK NAME %s\n",
- fsp->fs_spec);
- sumstatus |= 8;
- continue;
- }
- pid = fork();
- if (pid < 0) {
- perror("fork");
- exit(8);
- }
- if (pid == 0) {
- (void)signal(SIGQUIT, voidquit);
- checkfilesys(name);
- exit(0);
- } else {
- if (freelist == 0) {
- wp = (struct worklist *) malloc
- (sizeof(struct worklist));
- } else {
- wp = freelist;
- freelist = wp->next;
- }
- wp->next = listhead;
- listhead = wp;
- wp->pid = pid;
- sprintf(wp->name, "%s (%s)", name,
- fsp->fs_file);
- }
- }
- }
- if (preen) {
- union wait status;
- while ((pid = wait(&status)) != -1) {
- sumstatus |= status.w_retcode;
- pwp = 0;
- for (wp = listhead; wp; pwp = wp, wp = wp->next)
- if (wp->pid == pid)
- break;
- if (wp == 0) {
- printf("Unknown pid %d\n", pid);
- continue;
- }
- if (pwp == 0)
- listhead = wp->next;
- else
- pwp->next = wp->next;
- if (status.w_retcode != 0) {
- wp->next = badlist;
- badlist = wp;
- } else {
- wp->next = freelist;
- freelist = wp;
- }
- }
- }
- passno++;
- } while (anygtr);
- if (sumstatus) {
- if (badlist == 0)
- exit(8);
- printf("THE FOLLOWING FILE SYSTEM%s HAD AN %s\n\t",
- badlist->next ? "S" : "", "UNEXPECTED INCONSISTENCY:");
- for (wp = badlist; wp; wp = wp->next)
- printf("%s%s", wp->name, wp->next ? ", " : "\n");
- exit(8);
- }
- (void)endfsent();