Subject: bin/1421: changes to make make(1) use more POSIX interfaces.
To: None <gnats-bugs@gnats.netbsd.org>
From: matthew green <mrg@eterna.com.au>
List: netbsd-bugs
Date: 08/30/1995 16:47:43
>Number:         1421
>Category:       bin
>Synopsis:       changes to make make(1) use more POSIX interfaces.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 30 02:50:03 1995
>Last-Modified:
>Originator:     matthew green
>Organization:
bozotic softwar foundation
>Release:        950821
>Environment:
	
System: NetBSD splode.eterna.com.au 1.0A NetBSD 1.0A (_splode_) #245: Sat Aug 26 02:04:52 EST 1995 mrg@splode.eterna.com.au:/orb/q/build/src/sys/arch/sparc/compile/_splode_ sparc


>Description:

	this makes make use posix utime()/signals/waitpid, and a couple of
	other minor changes as well.

	<code/input/activities to reproduce the problem (multiple lines)>
>How-To-Repeat:
>Fix:

Index: arch.c
===================================================================
RCS file: /local/cvs/src/usr.bin/make/arch.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 arch.c
*** arch.c	1995/08/30 06:30:40	1.1.1.1
--- arch.c	1995/08/30 06:33:12
***************
*** 100,106 ****
--- 100,109 ----
  #include    <sys/param.h>
  #include    <ctype.h>
  #include    <ar.h>
+ #include    <utime.h>
+ #ifdef BSD
  #include    <ranlib.h>
+ #endif
  #include    <stdio.h>
  #include    <stdlib.h>
  #include    "make.h"
***************
*** 828,834 ****
  {
      FILE *	    arch;	/* Stream open to archive */
      struct ar_hdr   arh;      	/* Header describing table of contents */
!     struct timeval  times[2];	/* Times for utimes() call */
  
      arch = ArchFindMember (gn->path, RANLIBMAG, &arh, "r+");
      sprintf(arh.ar_date, "%-12ld", (long) now);
--- 831,837 ----
  {
      FILE *	    arch;	/* Stream open to archive */
      struct ar_hdr   arh;      	/* Header describing table of contents */
!     struct utimbuf times;
  
      arch = ArchFindMember (gn->path, RANLIBMAG, &arh, "r+");
      sprintf(arh.ar_date, "%-12ld", (long) now);
***************
*** 837,845 ****
  	(void)fwrite ((char *)&arh, sizeof (struct ar_hdr), 1, arch);
  	fclose (arch);
  
! 	times[0].tv_sec = times[1].tv_sec = now;
! 	times[0].tv_usec = times[1].tv_usec = 0;
! 	utimes(gn->path, times);
      }
  }
  
--- 840,847 ----
  	(void)fwrite ((char *)&arh, sizeof (struct ar_hdr), 1, arch);
  	fclose (arch);
  
! 	times.actime = times.modtime = now;
! 	utime(gn->path, &times);
      }
  }
  
***************
*** 981,987 ****
      Var_Set (TARGET, gn->name, gn);
  #else
      Var_Set (TARGET, gn->path == (char *) NULL ? gn->name : gn->path, gn);
! #endif LIBRARIES
  }
  
  /*-
--- 983,989 ----
      Var_Set (TARGET, gn->name, gn);
  #else
      Var_Set (TARGET, gn->path == (char *) NULL ? gn->name : gn->path, gn);
! #endif /* LIBRARIES */
  }
  
  /*-
Index: compat.c
===================================================================
RCS file: /local/cvs/src/usr.bin/make/compat.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 compat.c
*** compat.c	1995/08/30 06:30:38	1.1.1.1
--- compat.c	1995/08/30 06:33:12
***************
*** 157,163 ****
      register char *cp;
      Boolean 	  silent,   	/* Don't print command */
  		  errCheck; 	/* Check errors */
!     union wait 	  reason;   	/* Reason for child's death */
      int	    	  status;   	/* Description of child's death */
      int	    	  cpid;	    	/* Child actually found */
      ReturnStatus  stat;	    	/* Status of fork */
--- 157,163 ----
      register char *cp;
      Boolean 	  silent,   	/* Don't print command */
  		  errCheck; 	/* Check errors */
!     int           reason;   	/* Reason for child's death */
      int	    	  status;   	/* Description of child's death */
      int	    	  cpid;	    	/* Child actually found */
      ReturnStatus  stat;	    	/* Status of fork */
***************
*** 306,319 ****
  	
  	if (stat > -1) {
  	    if (WIFSTOPPED(reason)) {
! 		status = reason.w_stopval;		/* stopped */
  	    } else if (WIFEXITED(reason)) {
! 		status = reason.w_retcode;		/* exited */
  		if (status != 0) {
  		    printf ("*** Error code %d", status);
  		}
  	    } else {
! 		status = reason.w_termsig;		/* signaled */
  		printf ("*** Signal %d", status);
  	    } 
  
--- 306,319 ----
  	
  	if (stat > -1) {
  	    if (WIFSTOPPED(reason)) {
! 		status = 0177;				/* stopped */
  	    } else if (WIFEXITED(reason)) {
! 		status = WEXITSTATUS(reason);		/* exited */
  		if (status != 0) {
  		    printf ("*** Error code %d", status);
  		}
  	    } else {
! 		status = WTERMSIG(reason);		/* signaled */
  		printf ("*** Signal %d", status);
  	    } 
  
Index: dir.c
===================================================================
RCS file: /local/cvs/src/usr.bin/make/dir.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 dir.c
*** dir.c	1995/08/30 06:30:37	1.1.1.1
--- dir.c	1995/08/30 06:33:12
***************
*** 1065,1077 ****
  	    (void)readdir(d);
  	    
  	    while ((dp = readdir (d)) != (struct dirent *) NULL) {
! #ifdef sun
  		/*
  		 * The sun directory library doesn't check for a 0 inode
  		 * (0-inode slots just take up space), so we have to do
  		 * it ourselves.
  		 */
! 		if (dp->d_fileno == 0) {
  		    continue;
  		}
  #endif /* sun */
--- 1065,1077 ----
  	    (void)readdir(d);
  	    
  	    while ((dp = readdir (d)) != (struct dirent *) NULL) {
! #if defined(sun) && defined(d_ino) /* d_ino is a sunos4 #define for d_fileno */
  		/*
  		 * The sun directory library doesn't check for a 0 inode
  		 * (0-inode slots just take up space), so we have to do
  		 * it ourselves.
  		 */
! 		if (dp->d_ino == 0) {
  		    continue;
  		}
  #endif /* sun */
Index: job.c
===================================================================
RCS file: /local/cvs/src/usr.bin/make/job.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 job.c
*** job.c	1995/08/30 06:30:39	1.1.1.1
--- job.c	1995/08/30 06:33:13
***************
*** 112,117 ****
--- 112,118 ----
  #include <errno.h>
  #include <stdio.h>
  #include <string.h>
+ #include <utime.h>
  #include <signal.h>
  #include "make.h"
  #include "hash.h"
***************
*** 253,259 ****
  static int JobCmpPid __P((ClientData, ClientData));
  static int JobPrintCommand __P((ClientData, ClientData));
  static int JobSaveCommand __P((ClientData, ClientData));
! static void JobFinish __P((Job *, union wait));
  static void JobExec __P((Job *, char **));
  static void JobMakeArgv __P((Job *, char **));
  static void JobRestart __P((Job *));
--- 254,260 ----
  static int JobCmpPid __P((ClientData, ClientData));
  static int JobPrintCommand __P((ClientData, ClientData));
  static int JobSaveCommand __P((ClientData, ClientData));
! static void JobFinish __P((Job *, int));
  static void JobExec __P((Job *, char **));
  static void JobMakeArgv __P((Job *, char **));
  static void JobRestart __P((Job *));
***************
*** 317,323 ****
  JobPassSig(signo)
      int	    signo;	/* The signal number we've received */
  {
!     int	    mask;
      
      Lst_ForEach(jobs, JobCondPassSig, (ClientData)(long)signo);
  
--- 318,325 ----
  JobPassSig(signo)
      int	    signo;	/* The signal number we've received */
  {
!     sigset_t omask, nmask;
!     struct sigaction act;
      
      Lst_ForEach(jobs, JobCondPassSig, (ClientData)(long)signo);
  
***************
*** 345,360 ****
       * This ensures that all our jobs get continued when we wake up before
       * we take any other signal.
       */
!     mask = sigblock(0);
!     (void) sigsetmask(~0 & ~(1 << (signo-1)));
!     signal(signo, SIG_DFL);
  
      kill(getpid(), signo);
  
      signo = SIGCONT;
      Lst_ForEach(jobs, JobCondPassSig, (ClientData) &signo);
! 
!     sigsetmask(mask);
      signal(signo, JobPassSig);
  
  }
--- 347,367 ----
       * This ensures that all our jobs get continued when we wake up before
       * we take any other signal.
       */
!     sigemptyset(&nmask);
!     sigaddset(&nmask, signo);
!     sigprocmask(SIG_SETMASK, &nmask, &omask);
!     act.sa_handler = SIG_DFL;
!     sigemptyset(&act.sa_mask);
!     act.sa_flags = 0;
!     sigaction(signo, &act, NULL);
  
      kill(getpid(), signo);
  
      signo = SIGCONT;
      Lst_ForEach(jobs, JobCondPassSig, (ClientData) &signo);
!     sigprocmask(SIG_SETMASK, &omask, NULL);
!     act.sa_handler = JobPassSig;
!     sigaction(signo, &act, NULL);
      signal(signo, JobPassSig);
  
  }
***************
*** 601,613 ****
  static void
  JobFinish (job, status)
      Job           *job;	      	  /* job to finish */
!     union wait	  status;     	  /* sub-why job went away */
  {
      Boolean 	  done;
  
      if ((WIFEXITED(status) &&
! 	  (((status.w_retcode != 0) && !(job->flags & JOB_IGNERR)))) ||
! 	(WIFSIGNALED(status) && (status.w_termsig != SIGCONT)))
      {
  	/*
  	 * If it exited non-zero and either we're doing things our
--- 608,620 ----
  static void
  JobFinish (job, status)
      Job           *job;	      	  /* job to finish */
!     int status;
  {
      Boolean 	  done;
  
      if ((WIFEXITED(status) &&
! 	  (((WEXITSTATUS(status) != 0) && !(job->flags & JOB_IGNERR)))) ||
! 	(WIFSIGNALED(status) && (WTERMSIG(status) != SIGCONT)))
      {
  	/*
  	 * If it exited non-zero and either we're doing things our
***************
*** 637,643 ****
  	    fclose(job->cmdFILE);
  	}
  	done = TRUE;
!     } else if (WIFEXITED(status) && status.w_retcode != 0) {
  	/*
  	 * Deal with ignored errors in -B mode. We need to print a message
  	 * telling of the ignored error as well as setting status.w_status
--- 644,650 ----
  	    fclose(job->cmdFILE);
  	}
  	done = TRUE;
!     } else if (WIFEXITED(status) && WEXITSTATUS(status) != 0) {
  	/*
  	 * Deal with ignored errors in -B mode. We need to print a message
  	 * telling of the ignored error as well as setting status.w_status
***************
*** 656,662 ****
      
      if (done ||
  	WIFSTOPPED(status) ||
! 	(WIFSIGNALED(status) && (status.w_termsig == SIGCONT)) ||
  	DEBUG(JOB))
      {
  	FILE	  *out;
--- 663,669 ----
      
      if (done ||
  	WIFSTOPPED(status) ||
! 	(WIFSIGNALED(status) && (WTERMSIG(status) == SIGCONT)) ||
  	DEBUG(JOB))
      {
  	FILE	  *out;
***************
*** 673,689 ****
  	}
  
  	if (WIFEXITED(status)) {
! 	    if (status.w_retcode != 0) {
  		if (usePipes && job->node != lastNode) {
  		    fprintf (out, targFmt, job->node->name);
  		    lastNode = job->node;
  		}
! 		fprintf (out, "*** Error code %d%s\n", status.w_retcode,
  			 (job->flags & JOB_IGNERR) ? " (ignored)" : "");
  
! 		if (job->flags & JOB_IGNERR) {
! 		    status.w_status = 0;
! 		}
  	    } else if (DEBUG(JOB)) {
  		if (usePipes && job->node != lastNode) {
  		    fprintf (out, targFmt, job->node->name);
--- 680,695 ----
  	}
  
  	if (WIFEXITED(status)) {
! 	    if (WEXITSTATUS(status) != 0) {
  		if (usePipes && job->node != lastNode) {
  		    fprintf (out, targFmt, job->node->name);
  		    lastNode = job->node;
  		}
! 		fprintf (out, "*** Error code %d%s\n", WEXITSTATUS(status),
  			 (job->flags & JOB_IGNERR) ? " (ignored)" : "");
  
! 		if (job->flags & JOB_IGNERR)
! 		    status = 0;
  	    } else if (DEBUG(JOB)) {
  		if (usePipes && job->node != lastNode) {
  		    fprintf (out, targFmt, job->node->name);
***************
*** 697,709 ****
  		lastNode = job->node;
  	    }
  	    if (! (job->flags & JOB_REMIGRATE)) {
! 		fprintf (out, "*** Stopped -- signal %d\n", status.w_stopsig);
  	    }
  	    job->flags |= JOB_RESUME;
  	    (void)Lst_AtEnd(stoppedJobs, (ClientData)job);
  	    fflush(out);
  	    return;
! 	} else if (status.w_termsig == SIGCONT) {
  	    /*
  	     * If the beastie has continued, shift the Job from the stopped
  	     * list to the running one (or re-stop it if concurrency is
--- 703,715 ----
  		lastNode = job->node;
  	    }
  	    if (! (job->flags & JOB_REMIGRATE)) {
! 		fprintf (out, "*** Stopped -- signal %d\n", WSTOPSIG(status));
  	    }
  	    job->flags |= JOB_RESUME;
  	    (void)Lst_AtEnd(stoppedJobs, (ClientData)job);
  	    fflush(out);
  	    return;
! 	} else if (WTERMSIG(status) == SIGCONT) {
  	    /*
  	     * If the beastie has continued, shift the Job from the stopped
  	     * list to the running one (or re-stop it if concurrency is
***************
*** 738,744 ****
  		fprintf (out, targFmt, job->node->name);
  		lastNode = job->node;
  	    }
! 	    fprintf (out, "*** Signal %d\n", status.w_termsig);
  	}
  
  	fflush (out);
--- 744,750 ----
  		fprintf (out, targFmt, job->node->name);
  		lastNode = job->node;
  	    }
! 	    fprintf (out, "*** Signal %d\n", WTERMSIG(status));
  	}
  
  	fflush (out);
***************
*** 749,756 ****
       * try and restart the job on the next command. If JobStart says it's
       * ok, it's ok. If there's an error, this puppy is done.
       */
!     if ((status.w_status == 0) &&
! 	!Lst_IsAtEnd (job->node->commands))
      {
  	switch (JobStart (job->node,
  			  job->flags & JOB_IGNDOTS,
--- 755,761 ----
       * try and restart the job on the next command. If JobStart says it's
       * ok, it's ok. If there's an error, this puppy is done.
       */
!     if (status == 0 && !Lst_IsAtEnd (job->node->commands))
      {
  	switch (JobStart (job->node,
  			  job->flags & JOB_IGNDOTS,
***************
*** 761,767 ****
  		break;
  	    case JOB_ERROR:
  		done = TRUE;
! 		status.w_retcode = 1;
  		break;
  	    case JOB_FINISHED:
  		/*
--- 766,772 ----
  		break;
  	    case JOB_ERROR:
  		done = TRUE;
! 		status = (1 << 8);
  		break;
  	    case JOB_FINISHED:
  		/*
***************
*** 782,788 ****
      if (done &&
  	(aborting != ABORT_ERROR) &&
  	(aborting != ABORT_INTERRUPT) &&
! 	(status.w_status == 0))
      {
  	/*
  	 * As long as we aren't aborting and the job didn't return a non-zero
--- 787,793 ----
      if (done &&
  	(aborting != ABORT_ERROR) &&
  	(aborting != ABORT_INTERRUPT) &&
! 	(status == 0))
      {
  	/*
  	 * As long as we aren't aborting and the job didn't return a non-zero
***************
*** 798,804 ****
  	job->node->made = MADE;
  	Make_Update (job->node);
  	free((Address)job);
!     } else if (status.w_status) {
  	errors += 1;
  	free((Address)job);
      }
--- 803,809 ----
  	job->node->made = MADE;
  	Make_Update (job->node);
  	free((Address)job);
!     } else if (status) {
  	errors += 1;
  	free((Address)job);
      }
***************
*** 848,854 ****
      Boolean 	  silent;   	/* TRUE if should not print messages */
  {
      int		  streamID;   	/* ID of stream opened to do the touch */
!     struct timeval times[2];	/* Times for utimes() call */
  
      if (gn->type & (OP_JOIN|OP_USE|OP_EXEC|OP_OPTIONAL)) {
  	/*
--- 853,859 ----
      Boolean 	  silent;   	/* TRUE if should not print messages */
  {
      int		  streamID;   	/* ID of stream opened to do the touch */
!     struct utimbuf times;
  
      if (gn->type & (OP_JOIN|OP_USE|OP_EXEC|OP_OPTIONAL)) {
  	/*
***************
*** 873,881 ****
      } else {
  	char	*file = gn->path ? gn->path : gn->name;
  
! 	times[0].tv_sec = times[1].tv_sec = now;
! 	times[0].tv_usec = times[1].tv_usec = 0;
! 	if (utimes(file, times) < 0){
  	    streamID = open (file, O_RDWR | O_CREAT, 0666);
  
  	    if (streamID >= 0) {
--- 878,886 ----
      } else {
  	char	*file = gn->path ? gn->path : gn->name;
  
! 	times.actime = times.modtime = now;
! 	if (utime(file, &times) < 0) {
! 	
  	    streamID = open (file, O_RDWR | O_CREAT, 0666);
  
  	    if (streamID >= 0) {
***************
*** 1083,1089 ****
  	 */
  	
  	(void) setpgrp(0, getpid());
! #endif USE_PGRP
  
  	(void) execv (shellPath, argv);
  	(void) write (2, "Could not execute shell\n",
--- 1088,1094 ----
  	 */
  	
  	(void) setpgrp(0, getpid());
! #endif /* USE_PGRP */
  
  	(void) execv (shellPath, argv);
  	(void) write (2, "Could not execute shell\n",
***************
*** 1309,1315 ****
  	     */
  	    Boolean error;
  	    extern int errno;
! 	    union wait status;
  	    
  #ifdef RMT_WANTS_SIGNALS
  	    if (job->flags & JOB_REMOTE) {
--- 1314,1320 ----
  	     */
  	    Boolean error;
  	    extern int errno;
! 	    int status;
  	    
  #ifdef RMT_WANTS_SIGNALS
  	    if (job->flags & JOB_REMOTE) {
***************
*** 1324,1330 ****
  		 * actually put the thing in the job table.
  		 */
  		job->flags |= JOB_CONTINUING;
! 		status.w_termsig = SIGCONT;
  		JobFinish(job, status);
  		
  		job->flags &= ~(JOB_RESUME|JOB_CONTINUING);
--- 1329,1335 ----
  		 * actually put the thing in the job table.
  		 */
  		job->flags |= JOB_CONTINUING;
! 		status = SIGCONT;
  		JobFinish(job, status);
  		
  		job->flags &= ~(JOB_RESUME|JOB_CONTINUING);
***************
*** 1334,1341 ****
  	    } else {
  		Error("couldn't resume %s: %s",
  		    job->node->name, strerror(errno));
! 		status.w_status = 0;
! 		status.w_retcode = 1;
  		JobFinish(job, status);
  	    }
  	} else {
--- 1339,1346 ----
  	    } else {
  		Error("couldn't resume %s: %s",
  		    job->node->name, strerror(errno));
! 		status = 0;
! 		status = (1 << 8);
  		JobFinish(job, status);
  	    }
  	} else {
***************
*** 1946,1952 ****
      int    	  pid;	    	/* pid of dead child */
      register Job  *job;	    	/* job descriptor for dead child */
      LstNode       jnode;    	/* list element for finding job */
!     union wait	  status;   	/* Exit/termination status */
  
      /*
       * Don't even bother if we know there's no one around.
--- 1951,1957 ----
      int    	  pid;	    	/* pid of dead child */
      register Job  *job;	    	/* job descriptor for dead child */
      LstNode       jnode;    	/* list element for finding job */
!     int status;
  
      /*
       * Don't even bother if we know there's no one around.
***************
*** 1955,1962 ****
  	return;
      }
      
!     while ((pid = wait3((int *)&status, (block?0:WNOHANG)|WUNTRACED,
! 			(struct rusage *)0)) > 0)
      {
  	if (DEBUG(JOB))
  	    printf("Process %d exited or stopped.\n", pid);
--- 1960,1966 ----
  	return;
      }
      
!     while ((pid = waitpid(-1, &status, (block?0:WNOHANG)|WUNTRACED)) > 0)
      {
  	if (DEBUG(JOB))
  	    printf("Process %d exited or stopped.\n", pid);
***************
*** 1965,1971 ****
  	jnode = Lst_Find (jobs, (ClientData)&pid, JobCmpPid);
  
  	if (jnode == NILLNODE) {
! 	    if (WIFSIGNALED(status) && (status.w_termsig == SIGCONT)) {
  		jnode = Lst_Find(stoppedJobs, (ClientData) &pid, JobCmpPid);
  		if (jnode == NILLNODE) {
  		    Error("Resumed child (%d) not in table", pid);
--- 1969,1975 ----
  	jnode = Lst_Find (jobs, (ClientData)&pid, JobCmpPid);
  
  	if (jnode == NILLNODE) {
! 	    if (WIFSIGNALED(status) && (WTERMSIG(status) == SIGCONT)) {
  		jnode = Lst_Find(stoppedJobs, (ClientData) &pid, JobCmpPid);
  		if (jnode == NILLNODE) {
  		    Error("Resumed child (%d) not in table", pid);
***************
*** 2521,2528 ****
  		 */
  		union wait status;
  
! 		status.w_status = 0;
! 		status.w_retcode = 1;
  		JobFinish(job, status);
  	    }
  	} else if (job->pid) {
--- 2525,2532 ----
  		 */
  		union wait status;
  
! 		status = 0;
! 		WEXITSTATUS(status) = 1;
  		JobFinish(job, status);
  	    }
  	} else if (job->pid) {
***************
*** 2668,2674 ****
      /*
       * Catch as many children as want to report in at first, then give up
       */
!     while (wait3(&foo, WNOHANG, (struct rusage *)0) > 0)
  	continue;
      (void) unlink (tfile);
  }
--- 2672,2678 ----
      /*
       * Catch as many children as want to report in at first, then give up
       */
!     while (waitpid(-1, &foo, WNOHANG) > 0)
  	continue;
      (void) unlink (tfile);
  }
Index: lst.h
===================================================================
RCS file: /local/cvs/src/usr.bin/make/lst.h,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 lst.h
*** lst.h	1995/08/30 06:30:37	1.1.1.1
--- lst.h	1995/08/30 06:33:13
***************
*** 48,54 ****
  #define _LST_H_
  
  #include	<sprite.h>
! #include	<sys/cdefs.h>
  #if __STDC__
  #include	<stdlib.h>
  #endif
--- 48,54 ----
  #define _LST_H_
  
  #include	<sprite.h>
! #include	<sys/param.h>
  #if __STDC__
  #include	<stdlib.h>
  #endif
Index: main.c
===================================================================
RCS file: /local/cvs/src/usr.bin/make/main.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 main.c
*** main.c	1995/08/30 06:30:37	1.1.1.1
--- main.c	1995/08/30 06:33:13
***************
*** 102,108 ****
  
  #ifndef	DEFMAXLOCAL
  #define	DEFMAXLOCAL DEFMAXJOBS
! #endif	DEFMAXLOCAL
  
  #define	MAKEFLAGS	".MAKEFLAGS"
  
--- 102,108 ----
  
  #ifndef	DEFMAXLOCAL
  #define	DEFMAXLOCAL DEFMAXJOBS
! #endif	/* DEFMAXLOCAL */
  
  #define	MAKEFLAGS	".MAKEFLAGS"
  
***************
*** 416,422 ****
  	 * MACHINE_ARCH is always known at compile time.
  	 */
      	if (!machine) {
! 	    if (uname(&utsname)) {
  		    perror("make: uname");
  		    exit(2);
  	    }
--- 416,422 ----
  	 * MACHINE_ARCH is always known at compile time.
  	 */
      	if (!machine) {
! 	    if (uname(&utsname) < 0) {
  		    perror("make: uname");
  		    exit(2);
  	    }
Index: make.h
===================================================================
RCS file: /local/cvs/src/usr.bin/make/make.h,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 make.h
*** make.h	1995/08/30 06:30:35	1.1.1.1
--- make.h	1995/08/30 06:33:13
***************
*** 52,58 ****
  #include <stdio.h>
  #include <string.h>
  #include <ctype.h>
! #ifndef MAKE_BOOTSTRAP
  #include <sys/cdefs.h>
  #else
  #if defined(__STDC__) || defined(__cplusplus)
--- 52,58 ----
  #include <stdio.h>
  #include <string.h>
  #include <ctype.h>
! #if !defined(MAKE_BOOTSTRAP) && defined(BSD)
  #include <sys/cdefs.h>
  #else
  #if defined(__STDC__) || defined(__cplusplus)
>Audit-Trail:
>Unformatted: