Parallel make installs often cause 2 concurrent install -d to fail while they are creating the path to the target dirs. This patch changes the failure to a warning so that a make -j6 install doesn't fails as often as it does on Gentoo/FreeBSD, if it uses /usr/bin/install. --- usr.bin/xinstall/xinstall.c.orig +++ usr.bin/xinstall/xinstall.c @@ -748,9 +748,17 @@ ch = *p; *p = '\0'; if (stat(path, &sb)) { - if (errno != ENOENT || mkdir(path, 0755) < 0) { + if (errno != ENOENT) { err(EX_OSERR, "mkdir %s", path); /* NOTREACHED */ + } else if (mkdir(path, 0755) < 0) { + /* Previous errno from stat() says that the directory didn't exist (ENOENT) + * But if errno is now EEXIST, then we just hit a parallel make bug. + */ + if (errno == EEXIST) + warn("mkdir: %s now exists!", path); /* let me know when this happens */ + else + err(EX_OSERR, "mkdir %s", path); } else if (verbose) (void)printf("install: mkdir %s\n", path);