greg@sdcsvax.UUCP (Greg Noel) (11/04/83)
A bug has been found in the 4.2 version of make. The symptoms are various kinds of flakeyness in large makefiles or in makefiles that reference a lot of different directories for files. The problem is that after the vfork to execute the command the child would mark the parent's files as closed. If make needed to look in the directory again, it would reopen it. Eventually, make (or a child) would run out of avalilable file descriptors. The cure is to replace subroutine doclose in the file dosys.c with the following code: --------------------------- cut here ------------------------------------ doclose() /* Close open directory files before exec'ing */ { register struct dirhdr *od; /* Original code: for (od = firstod; od; od = od->nxtopendir) if (od->dirfc != NULL) { closedir(od->dirfc); od->dirfc = NULL; } We have done a vfork, so we can't do anything to stomp on our parent's address space. Unfortunately, the code above doesn't work since our parent's files remain open. And we can't just do a closedir, since it will free a dynamicly-allocated table entry. So we use this hack, calling close directly. If the interface ever changes, we are going to be out of luck. */ for (od = firstod; od; od = od->nxtopendir) if (od->dirfc != NULL) close(od->dirfc->dd_fd); }