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

Diff for /src/usr.bin/cvs/entries.c between version 1.31 and 1.32

version 1.31, 2005/05/26 21:25:49 version 1.32, 2005/05/26 22:25:31
Line 53 
Line 53 
 cvs_ent_open(const char *dir, int flags)  cvs_ent_open(const char *dir, int flags)
 {  {
         size_t len;          size_t len;
         int exists, l;          int exists;
         char entpath[MAXPATHLEN], ebuf[128], mode[4];          char entpath[MAXPATHLEN], ebuf[128], mode[4];
         FILE *fp;          FILE *fp;
         struct stat st;          struct stat st;
Line 63 
Line 63 
         exists = 0;          exists = 0;
         memset(mode, 0, sizeof(mode));          memset(mode, 0, sizeof(mode));
   
         l = snprintf(entpath, sizeof(entpath), "%s/" CVS_PATH_ENTRIES, dir);          len = cvs_path_cat(dir, CVS_PATH_ENTRIES, entpath, sizeof(entpath));
         if (l == -1 || l >= (int)sizeof(entpath)) {          if (len >= sizeof(entpath)) {
                 errno = ENAMETOOLONG;                  errno = ENAMETOOLONG;
                 cvs_log(LP_ERRNO, "%s", entpath);                  cvs_log(LP_ERRNO, "%s", entpath);
                 return (NULL);                  return (NULL);
Line 163 
Line 163 
                 (void)cvs_ent_write(ep);                  (void)cvs_ent_write(ep);
         }          }
   
         if (ep->cef_file != NULL)  
                 (void)fclose(ep->cef_file);  
         if (ep->cef_path != NULL)          if (ep->cef_path != NULL)
                 free(ep->cef_path);                  free(ep->cef_path);
   
Line 412 
Line 410 
         size_t len;          size_t len;
         char revbuf[64], timebuf[32];          char revbuf[64], timebuf[32];
         struct cvs_ent *ent;          struct cvs_ent *ent;
           FILE *fp;
   
         if (ef->cef_flags & CVS_ENTF_SYNC)          if (ef->cef_flags & CVS_ENTF_SYNC)
                 return (0);                  return (0);
   
         if (ef->cef_file == NULL) {          if ((fp = fopen(ef->cef_path, "w")) == NULL) {
                 ef->cef_file = fopen(ef->cef_path, "w");                  cvs_log(LP_ERRNO, "failed to open Entries `%s'", ef->cef_path);
                 if (ef->cef_file == NULL) {                  return (-1);
                         cvs_log(LP_ERRNO, "failed to open Entries `%s'",  
                             ef->cef_path);  
                         return (-1);  
                 }  
         }          }
   
   
         /* reposition ourself at beginning of file */  
         rewind(ef->cef_file);  
         TAILQ_FOREACH(ent, &(ef->cef_ent), ce_list) {          TAILQ_FOREACH(ent, &(ef->cef_ent), ce_list) {
                 if (ent->ce_type == CVS_ENT_DIR) {                  if (ent->ce_type == CVS_ENT_DIR) {
                         putc('D', ef->cef_file);                          putc('D', fp);
                         timebuf[0] = '\0';                          timebuf[0] = '\0';
                         revbuf[0] = '\0';                          revbuf[0] = '\0';
                 } else {                  } else {
Line 447 
Line 439 
                         }                          }
                 }                  }
   
                 fprintf(ef->cef_file, "/%s/%s%s/%s/%s/%s\n", ent->ce_name,                  fprintf(fp, "/%s/%s%s/%s/%s/%s\n", ent->ce_name,
                     (ent->ce_status == CVS_ENT_REMOVED) ? "-" : "", revbuf,                      (ent->ce_status == CVS_ENT_REMOVED) ? "-" : "", revbuf,
                     timebuf, "", "");                      timebuf, "", "");
         }          }
   
         /* terminating line */          /* terminating line */
         fprintf(ef->cef_file, "D\n");          putc('D', fp);
           putc('\n', fp);
   
         ef->cef_flags |= CVS_ENTF_SYNC;          ef->cef_flags |= CVS_ENTF_SYNC;
         fclose(ef->cef_file);          fclose(fp);
         ef->cef_file = NULL;  
   
         return (0);          return (0);
 }  }

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.32