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

Diff for /src/usr.bin/cvs/file.c between version 1.90 and 1.91

version 1.90, 2005/06/17 15:09:55 version 1.91, 2005/07/01 08:59:09
Line 639 
Line 639 
   
         cvs_file_getpath(cf, fpath, sizeof(fpath));          cvs_file_getpath(cf, fpath, sizeof(fpath));
         cf->cf_root = cvsroot_get(fpath);          cf->cf_root = cvsroot_get(fpath);
         if (cf->cf_root == NULL)          if (cf->cf_root == NULL) {
                   /*
                    * Do not fail here for an unknown directory.
                    */
                   if (cf->cf_cvstat == CVS_FST_UNKNOWN)
                           return (0);
                 return (-1);                  return (-1);
           }
   
         if (flags & CF_MKADMIN)          if (flags & CF_MKADMIN)
                 cvs_mkadmin(fpath, cf->cf_root->cr_str, NULL);                  cvs_mkadmin(fpath, cf->cf_root->cr_str, NULL);
Line 677 
Line 683 
 static int  static int
 cvs_file_getdir(CVSFILE *cf, int flags, char *path, int (*cb)(CVSFILE *, void *), void *arg)  cvs_file_getdir(CVSFILE *cf, int flags, char *path, int (*cb)(CVSFILE *, void *), void *arg)
 {  {
         int l;          int l, ret;
         int check_entry;          int check_entry;
         u_int ndirs, nfiles;          u_int ndirs, nfiles;
         char *cur, *np;          char *cur, *np;
Line 689 
Line 695 
         DIR *dirp;          DIR *dirp;
         CVSENTRIES *entfile;          CVSENTRIES *entfile;
   
           ret = -1;
         check_entry = 1;          check_entry = 1;
         ndirs = nfiles = 0;          ndirs = nfiles = 0;
         SIMPLEQ_INIT(&dirs);          SIMPLEQ_INIT(&dirs);
   
         cvs_file_getpath(cf, fpath, sizeof(fpath));          cvs_file_getpath(cf, fpath, sizeof(fpath));
         entfile = cvs_ent_open(fpath, O_RDONLY);  
   
         cf->cf_root = cvsroot_get(fpath);  
         if (cf->cf_root == NULL)  
                 return (-1);  
   
         cur = np = NULL;          cur = np = NULL;
         if (path != NULL) {          if (path != NULL) {
                 cur = strchr(path, '/');                  cur = strchr(path, '/');
Line 720 
Line 722 
                         return (-1);                          return (-1);
         }          }
   
           cf->cf_root = cvsroot_get(fpath);
           if (cf->cf_root == NULL) {
                   /*
                    * Do not fail here for an unknown directory.
                    */
                   if (cf->cf_cvstat == CVS_FST_UNKNOWN)
                           return (0);
                   return (-1);
           }
   
         dirp = opendir(fpath);          dirp = opendir(fpath);
         if (dirp == NULL) {          if (dirp == NULL) {
                 cvs_log(LP_ERRNO, "failed to open directory %s", fpath);                  cvs_log(LP_ERRNO, "failed to open directory %s", fpath);
                 return (-1);                  return (-1);
         }          }
   
           entfile = cvs_ent_open(fpath, O_RDONLY);
         while ((ent = readdir(dirp)) != NULL) {          while ((ent = readdir(dirp)) != NULL) {
                 if ((flags & CF_IGNORE) && cvs_file_chkign(ent->d_name))                  if ((flags & CF_IGNORE) && cvs_file_chkign(ent->d_name))
                         continue;                          continue;
Line 754 
Line 767 
                         errno = ENAMETOOLONG;                          errno = ENAMETOOLONG;
                         cvs_log(LP_ERRNO, "%s", pbuf);                          cvs_log(LP_ERRNO, "%s", pbuf);
                         closedir(dirp);                          closedir(dirp);
                         return (-1);                          goto done;
                 }                  }
   
                 cfp = cvs_file_find(cf, ent->d_name);                  cfp = cvs_file_find(cf, ent->d_name);
Line 768 
Line 781 
   
                         if (cfp == NULL) {                          if (cfp == NULL) {
                                 closedir(dirp);                                  closedir(dirp);
                                 return (-1);                                  goto done;
                         }                          }
                         if (entfile != NULL)                          if (entfile != NULL)
                                 cvs_ent_remove(entfile, cfp->cf_name);                                  cvs_ent_remove(entfile, cfp->cf_name);
Line 790 
Line 803 
                         if (cb != NULL) {                          if (cb != NULL) {
                                 if (cb(cfp, arg) != CVS_EX_OK) {                                  if (cb(cfp, arg) != CVS_EX_OK) {
                                         closedir(dirp);                                          closedir(dirp);
                                         return (-1);                                          goto done;
                                 }                                  }
                         }                          }
                 }                  }
Line 815 
Line 828 
                         if (l == -1 || l >= (int)sizeof(pbuf)) {                          if (l == -1 || l >= (int)sizeof(pbuf)) {
                                 errno = ENAMETOOLONG;                                  errno = ENAMETOOLONG;
                                 cvs_log(LP_ERRNO, "%s", pbuf);                                  cvs_log(LP_ERRNO, "%s", pbuf);
                                 return (-1);                                  goto done;
                         }                          }
   
                         cfp = cvs_file_find(cf, cvsent->ce_name);                          cfp = cvs_file_find(cf, cvsent->ce_name);
Line 841 
Line 854 
                                 /* callback for the file */                                  /* callback for the file */
                                 if (cb != NULL) {                                  if (cb != NULL) {
                                         if (cb(cfp, arg) != CVS_EX_OK)                                          if (cb(cfp, arg) != CVS_EX_OK)
                                                 return (-1);                                                  goto done;
                                 }                                  }
                         }                          }
   
                         if (path != NULL)                          if (path != NULL)
                                 break;                                  break;
                 }                  }
                 cvs_ent_close(entfile);  
         }          }
   
         if (flags & CF_SORT) {          if (flags & CF_SORT) {
Line 873 
Line 885 
                 }                  }
         }          }
   
         return (0);          ret = 0;
   done:
           if (entfile != NULL)
                   cvs_ent_close(entfile);
   
           return (ret);
 }  }
   
   
Line 1198 
Line 1215 
   
                         cfp = cvs_file_find(cvs_files, fpath);                          cfp = cvs_file_find(cvs_files, fpath);
                         if (cfp == NULL)                          if (cfp == NULL)
                                   continue;
   
                           /* ignore unknown directories */
                           if (cfp->cf_cvstat == CVS_FST_UNKNOWN)
                                 continue;                                  continue;
   
                         if (cvs_file_prune(fpath)) {                          if (cvs_file_prune(fpath)) {

Legend:
Removed from v.1.90  
changed lines
  Added in v.1.91