[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.15 and 1.16

version 1.15, 2004/08/13 13:24:13 version 1.16, 2004/08/27 15:44:38
Line 128 
Line 128 
         }          }
   
         /* only keep a pointer to the open file if we're in writing mode */          /* only keep a pointer to the open file if we're in writing mode */
         if ((flags & O_WRONLY) || (flags & O_RDWR)) {          if ((flags & O_WRONLY) || (flags & O_RDWR))
                 ep->cef_flags |= CVS_ENTF_WR;                  ep->cef_flags |= CVS_ENTF_WR;
                 ep->cef_file = fp;  
         }  
         else  
                 (void)fclose(fp);  
   
           (void)fclose(fp);
   
         if (exists)          if (exists)
                 ep->cef_flags |= CVS_ENTF_SYNC;                  ep->cef_flags |= CVS_ENTF_SYNC;
   
Line 188 
Line 186 
 int  int
 cvs_ent_add(CVSENTRIES *ef, struct cvs_ent *ent)  cvs_ent_add(CVSENTRIES *ef, struct cvs_ent *ent)
 {  {
         if (ef->cef_file == NULL) {          if (!(ef->cef_flags & CVS_ENTF_WR)) {
                 cvs_log(LP_ERR, "Entries file is opened in read-only mode");                  cvs_log(LP_ERR, "Entries file is opened in read-only mode");
                 return (-1);                  return (-1);
         }          }
Line 215 
Line 213 
 {  {
         struct cvs_ent *ent;          struct cvs_ent *ent;
   
         if (ef->cef_file == NULL) {          if (!(ef->cef_flags & CVS_ENTF_WR)) {
                 cvs_log(LP_ERR, "Entries file is opened in read-only mode");                  cvs_log(LP_ERR, "Entries file is opened in read-only mode");
                 return (-1);                  return (-1);
         }          }
Line 246 
Line 244 
 {  {
         struct cvs_ent *ent;          struct cvs_ent *ent;
   
           if (!(ef->cef_flags & CVS_ENTF_WR)) {
                   cvs_log(LP_ERR, "Entries file is opened in read-only mode");
                   return (-1);
           }
   
         ent = cvs_ent_get(ef, name);          ent = cvs_ent_get(ef, name);
         if (ent == NULL)          if (ent == NULL)
                 return (-1);                  return (-1);
Line 440 
Line 443 
         char revbuf[64], timebuf[32];          char revbuf[64], timebuf[32];
         struct cvs_ent *ent;          struct cvs_ent *ent;
   
         if (ef->cef_file == NULL)  
                 return (-1);  
   
         if (ef->cef_flags & CVS_ENTF_SYNC)          if (ef->cef_flags & CVS_ENTF_SYNC)
                 return (0);                  return (0);
   
           if (ef->cef_file == NULL) {
                   ef->cef_file = fopen(ef->cef_path, "w");
                   if (ef->cef_file == NULL) {
                           cvs_log(LP_ERRNO, "failed to open Entries `%s'",
                               ef->cef_path);
                           return (-1);
                   }
           }
   
   
         /* reposition ourself at beginning of file */          /* reposition ourself at beginning of file */
         rewind(ef->cef_file);          rewind(ef->cef_file);
         TAILQ_FOREACH(ent, &(ef->cef_ent), ce_list) {          TAILQ_FOREACH(ent, &(ef->cef_ent), ce_list) {
Line 475 
Line 485 
         fprintf(ef->cef_file, "D\n");          fprintf(ef->cef_file, "D\n");
   
         ef->cef_flags |= CVS_ENTF_SYNC;          ef->cef_flags |= CVS_ENTF_SYNC;
           fclose(ef->cef_file);
           ef->cef_file = NULL;
   
         return (0);          return (0);
 }  }

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16