Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site sdcsvax.UUCP Path: utzoo!linus!security!genrad!decvax!sdchema!sdcsvax!greg From: greg@sdcsvax.UUCP (Greg Noel) Newsgroups: net.unix-wizards,net.bugs.4bsd Subject: Bug fix for 4.2BSD (and earlier?) make Message-ID: <3913@sdcsvax.UUCP> Date: Fri, 4-Nov-83 04:01:42 EST Article-I.D.: sdcsvax.3913 Posted: Fri Nov 4 04:01:42 1983 Date-Received: Thu, 17-Nov-83 23:04:58 EST Organization: U.C. San Diego, Computer Science Dept. Lines: 29 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); }