[BACK]Return to job.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / make

Diff for /src/usr.bin/make/job.c between version 1.6 and 1.7

version 1.6, 1996/11/30 21:08:56 version 1.7, 1997/06/15 21:29:22
Line 164 
Line 164 
   
 /*  /*
  * tfile is the name of a file into which all shell commands are put. It is   * tfile is the name of a file into which all shell commands are put. It is
  * used over by removing it before the child shell is executed. The XXXXX in   * used over by removing it before the child shell is executed. The XXXXXXXXXX
  * the string are replaced by the pid of the make process in a 5-character   * in the string are replaced by mkstemp(3).
  * field with leading zeroes.  
  */   */
 static char     tfile[] = TMPPAT;  static char     tfile[sizeof(TMPPAT)];
   
   
 /*  /*
Line 1663 
Line 1662 
 {  {
     register Job  *job;       /* new job descriptor */      register Job  *job;       /* new job descriptor */
     char          *argv[4];   /* Argument vector to shell */      char          *argv[4];   /* Argument vector to shell */
     static int    jobno = 0;  /* job number of catching output in a file */  
     Boolean       cmdsOK;     /* true if the nodes commands were all right */      Boolean       cmdsOK;     /* true if the nodes commands were all right */
     Boolean       local;      /* Set true if the job was run locally */      Boolean       local;      /* Set true if the job was run locally */
     Boolean       noExec;     /* Set true if we decide not to run the job */      Boolean       noExec;     /* Set true if we decide not to run the job */
Line 1869 
Line 1867 
     /*      /*
      * If we're using pipes to catch output, create the pipe by which we'll       * If we're using pipes to catch output, create the pipe by which we'll
      * get the shell's output. If we're using files, print out that we're       * get the shell's output. If we're using files, print out that we're
      * starting a job and then set up its temporary-file name. This is just       * starting a job and then set up its temporary-file name.
      * tfile with two extra digits tacked on -- jobno.  
      */       */
     if (!compatMake || (job->flags & JOB_FIRST)) {      if (!compatMake || (job->flags & JOB_FIRST)) {
         if (usePipes) {          if (usePipes) {
Line 1884 
Line 1881 
         } else {          } else {
             (void) fprintf(stdout, "Remaking `%s'\n", gn->name);              (void) fprintf(stdout, "Remaking `%s'\n", gn->name);
             (void) fflush(stdout);              (void) fflush(stdout);
             sprintf(job->outFile, "%s%02d", tfile, jobno);              (void) strcpy(job->outFile, TMPPAT);
             jobno = (jobno + 1) % 100;              if ((job->outFd = mkstemp(job->outFile)) == -1)
             job->outFd = open(job->outFile,O_WRONLY|O_CREAT|O_APPEND,0600);                  Punt("Cannot create temp file: %s", strerror(errno));
             (void) fcntl(job->outFd, F_SETFD, 1);              (void) fcntl(job->outFd, F_SETFD, 1);
         }          }
     }      }
Line 2402 
Line 2399 
                              * be running at once. */                               * be running at once. */
 {  {
     GNode         *begin;     /* node for commands to do at the very start */      GNode         *begin;     /* node for commands to do at the very start */
       int           tfd;
   
     (void) sprintf(tfile, "/tmp/make%05d", getpid());      (void) strcpy(tfile, TMPPAT);
       if ((tfd = mkstemp(tfile)) == -1)
           Punt("Cannot create temp file: %s", strerror(errno));
       else
           (void) close(tfd);
   
     jobs =        Lst_Init(FALSE);      jobs =        Lst_Init(FALSE);
     stoppedJobs = Lst_Init(FALSE);      stoppedJobs = Lst_Init(FALSE);

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7