MAKE HUNG ON SINGLE "-" ARGUMENT
authorJohn Woods <jfw@eddie.mit.edu>
Tue, 17 Mar 1992 00:00:00 +0000 (00:00 +0000)
committerJohn Woods <jfw@eddie.mit.edu>
Tue, 17 Mar 1992 00:00:00 +0000 (00:00 +0000)
[ This is a patch rolled in from work done on 4.3Reno/NET2 ]

There is a bug in the new make from 4.3Reno and also present in the Net2
release (as found on uunet).  A command line argument consisting of a lone
dash (-) causes an infinite loop ("make - make" was an excellent test case).

AUTHOR: John Woods (jfw@eddie.mit.edu)
386BSD-Patchkit: patch00015

usr/src/usr.bin/make/main.c

index 0c74944..959e7b6 100644 (file)
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
+ *
+ * PATCHES MAGIC                LEVEL   PATCH THAT GOT US HERE
+ * --------------------         -----   ----------------------
+ * CURRENT PATCH LEVEL:         1       00015
+ * --------------------         -----   ----------------------
+ *
+ * 17 Mar 92   John Woods              Fix "make - make" bug
  */
 
 #ifndef lint
  */
 
 #ifndef lint
@@ -280,7 +287,10 @@ rearg:     while((c = getopt(argc, argv, "D:I:d:ef:ij:knqrst")) != EOF) {
                        if (!**argv)
                                Punt("illegal (null) argument.");
                        if (**argv == '-') {
                        if (!**argv)
                                Punt("illegal (null) argument.");
                        if (**argv == '-') {
-                               optind = 0;
+/* 17 Mar 92*/                 if ((*argv)[1])
+/* 17 Mar 92*/                         optind = 0;     /* -flag... */
+/* 17 Mar 92*/                 else
+/* 17 Mar 92*/                         optind = 1;     /* - */
                                goto rearg;
                        }
                        (void)Lst_AtEnd(create, (ClientData)*argv);
                                goto rearg;
                        }
                        (void)Lst_AtEnd(create, (ClientData)*argv);