Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Jan 1998 18:03:16 +0000
From:      James Raynard <fcurrent@jraynard.demon.co.uk>
To:        freebsd-current@freebsd.org
Subject:   make -j install fix
Message-ID:  <19980104180316.06571@jraynard.demon.co.uk>

next in thread | raw e-mail | index | archive | help
Having investigated this a little more, I think the following is
better than the diff I posted a few days ago (there seems to be
a window where /bin/sh isn't there and execv() returns ENOENT -
also one second seems a little short to sleep).  Comments?

Index: job.c
===================================================================
RCS file: /home/cvs/src/usr.bin/make/job.c,v
retrieving revision 1.7
diff -u -r1.7 job.c
--- job.c	1997/02/22 19:27:11	1.7
+++ job.c	1998/01/04 17:53:04
@@ -1269,6 +1269,17 @@
 #endif /* REMOTE */
 	   (void) execv(shellPath, argv);
 
+	/*
+	 * When using the -j option to install /bin, there
+	 * is a possibility the above call will fail if
+	 * /bin/sh was being installed at the same time as this
+	 * target.  To avoid this, we sleep for a few seconds
+	 * and retry.
+	 */
+	if (errno == EACCES || errno == ENOENT) {
+	   (void) sleep(3);
+	   (void) execv(shellPath, argv);
+	}
 	(void) write(2, "Could not execute shell\n",
 		     sizeof("Could not execute shell"));
 	_exit(1);

-- 
In theory, theory is better than practice.  In practice, it isn't.
James Raynard, Edinburgh, Scotland.   http://www.freebsd.org/~jraynard/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980104180316.06571>