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

Diff for /src/usr.bin/make/engine.c between version 1.5 and 1.6

version 1.5, 2007/09/17 09:28:36 version 1.6, 2007/09/17 12:07:22
Line 55 
Line 55 
   
 static void MakeTimeStamp(void *, void *);  static void MakeTimeStamp(void *, void *);
 static void MakeAddAllSrc(void *, void *);  static void MakeAddAllSrc(void *, void *);
   static int rewrite_time(const char *);
   
 /*-  /*-
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
Line 121 
Line 122 
         return true;          return true;
 }  }
   
   /* touch files the hard way, by writing stuff to them */
   static int
   rewrite_time(const char *name)
   {
           int fd;
           char c;
   
           fd = open(name, O_RDWR | O_CREAT, 0666);
           if (fd < 0)
                   return -1;
           /*
            * Read and write a byte to the file to change
            * the modification time.
            */
           if (read(fd, &c, 1) == 1) {
                   (void)lseek(fd, 0, SEEK_SET);
                   (void)write(fd, &c, 1);
           }
   
           (void)close(fd);
           return 0;
   }
   
 /*-  /*-
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  * Job_Touch --   * Job_Touch --
Line 135 
Line 159 
 void  void
 Job_Touch(GNode *gn, bool silent)  Job_Touch(GNode *gn, bool silent)
 {  {
         int streamID;   /* ID of stream opened to do the touch */  
   
         if (gn->type & (OP_JOIN|OP_USE|OP_EXEC|OP_OPTIONAL)) {          if (gn->type & (OP_JOIN|OP_USE|OP_EXEC|OP_OPTIONAL)) {
                 /*                  /*
                  * .JOIN, .USE, .ZEROTIME and .OPTIONAL targets are "virtual"                   * .JOIN, .USE, .ZEROTIME and .OPTIONAL targets are "virtual"
Line 162 
Line 184 
                 const char *file = gn->path != NULL ? gn->path : gn->name;                  const char *file = gn->path != NULL ? gn->path : gn->name;
   
                 if (set_times(file) == -1){                  if (set_times(file) == -1){
                         streamID = open(file, O_RDWR | O_CREAT, 0666);                          if (rewrite_time(file) == -1) {
   
                         if (streamID >= 0) {  
                                 char    c;  
   
                                 /*  
                                  * Read and write a byte to the file to change  
                                  * the modification time, then close the file.  
                                  */  
                                 if (read(streamID, &c, 1) == 1) {  
                                         (void)lseek(streamID, 0, SEEK_SET);  
                                         (void)write(streamID, &c, 1);  
                                 }  
   
                                 (void)close(streamID);  
                         } else {  
                                 (void)fprintf(stdout,                                  (void)fprintf(stdout,
                                     "*** couldn't touch %s: %s", file,                                      "*** couldn't touch %s: %s", file,
                                     strerror(errno));                                      strerror(errno));

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