[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.182 and 1.183

version 1.182, 2007/01/29 15:47:39 version 1.183, 2007/01/31 21:07:35
Line 71 
Line 71 
 void  void
 cvs_file_init(void)  cvs_file_init(void)
 {  {
         int i, l;          int i;
         FILE *ifp;          FILE *ifp;
         size_t len;          size_t len;
         char path[MAXPATHLEN], buf[MAXNAMLEN];          char path[MAXPATHLEN], buf[MAXNAMLEN];
Line 84 
Line 84 
                 cvs_file_ignore(cvs_ign_std[i], &cvs_ign_pats);                  cvs_file_ignore(cvs_ign_std[i], &cvs_ign_pats);
   
         /* read the cvsignore file in the user's home directory, if any */          /* read the cvsignore file in the user's home directory, if any */
         l = snprintf(path, MAXPATHLEN, "%s/.cvsignore", cvs_homedir);          (void)xsnprintf(path, MAXPATHLEN, "%s/.cvsignore", cvs_homedir);
         if (l == -1 || l >= MAXPATHLEN)  
                 fatal("overflow in cvs_file_init");  
   
         ifp = fopen(path, "r");          ifp = fopen(path, "r");
         if (ifp == NULL) {          if (ifp == NULL) {
Line 199 
Line 197 
 struct cvs_file *  struct cvs_file *
 cvs_file_get_cf(const char *d, const char *f, int fd, int type)  cvs_file_get_cf(const char *d, const char *f, int fd, int type)
 {  {
         int l;  
         struct cvs_file *cf;          struct cvs_file *cf;
         char *p, rpath[MAXPATHLEN];          char *p, rpath[MAXPATHLEN];
   
         l = snprintf(rpath, MAXPATHLEN, "%s/%s", d, f);          (void)xsnprintf(rpath, MAXPATHLEN, "%s/%s", d, f);
         if (l == -1 || l >= MAXPATHLEN)  
                 fatal("cvs_file_get_cf: overflow");  
   
         for (p = rpath; p[0] == '.' && p[1] == '/';)          for (p = rpath; p[0] == '.' && p[1] == '/';)
                 p += 2;                  p += 2;
Line 228 
Line 223 
 void  void
 cvs_file_walklist(struct cvs_flisthead *fl, struct cvs_recursion *cr)  cvs_file_walklist(struct cvs_flisthead *fl, struct cvs_recursion *cr)
 {  {
         int len, fd, type;          int fd, type;
         struct stat st;          struct stat st;
         struct cvs_file *cf;          struct cvs_file *cf;
         struct cvs_filelist *l, *nxt;          struct cvs_filelist *l, *nxt;
Line 272 
Line 267 
                         }                          }
   
                         cvs_get_repository_path(d, repo, MAXPATHLEN);                          cvs_get_repository_path(d, repo, MAXPATHLEN);
                         len = snprintf(fpath, MAXPATHLEN, "%s/%s",                          (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s",
                             repo, f);                              repo, f);
                         if (len == -1 || len >= MAXPATHLEN)  
                                 fatal("cvs_file_walklist: overflow");  
   
                         if ((fd = open(fpath, O_RDONLY)) == -1) {                          if ((fd = open(fpath, O_RDONLY)) == -1) {
                                 strlcat(fpath, RCS_FILE_EXT, MAXPATHLEN);                                  strlcat(fpath, RCS_FILE_EXT, MAXPATHLEN);
Line 357 
Line 350 
          * If we do not have a admin directory inside here, dont bother,           * If we do not have a admin directory inside here, dont bother,
          * unless we are running import.           * unless we are running import.
          */           */
         l = snprintf(fpath, MAXPATHLEN, "%s/%s", cf->file_path,          (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s", cf->file_path,
             CVS_PATH_CVSDIR);              CVS_PATH_CVSDIR);
         if (l == -1 || l >= MAXPATHLEN)  
                 fatal("cvs_file_walkdir: overflow");  
   
         l = stat(fpath, &st);          l = stat(fpath, &st);
         if (cvs_cmdop != CVS_OP_IMPORT &&          if (cvs_cmdop != CVS_OP_IMPORT &&
Line 371 
Line 362 
         /*          /*
          * check for a local .cvsignore file           * check for a local .cvsignore file
          */           */
         l = snprintf(fpath, MAXPATHLEN, "%s/.cvsignore", cf->file_path);          (void)xsnprintf(fpath, MAXPATHLEN, "%s/.cvsignore", cf->file_path);
         if (l == -1 || l >= MAXPATHLEN)  
                 fatal("cvs_file_walkdir: overflow");  
   
         if ((fp = fopen(fpath, "r")) != NULL) {          if ((fp = fopen(fpath, "r")) != NULL) {
                 while (fgets(fpath, MAXPATHLEN, fp) != NULL) {                  while (fgets(fpath, MAXPATHLEN, fp) != NULL) {
Line 420 
Line 409 
                                 continue;                                  continue;
                         }                          }
   
                         l = snprintf(fpath, MAXPATHLEN, "%s/%s",                          (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s",
                             cf->file_path, dp->d_name);                              cf->file_path, dp->d_name);
                         if (l == -1 || l >= MAXPATHLEN)  
                                 fatal("cvs_file_walkdir: overflow");  
   
                         /*                          /*
                          * nfs and afs will show d_type as DT_UNKNOWN                           * nfs and afs will show d_type as DT_UNKNOWN
Line 506 
Line 493 
         TAILQ_FOREACH(line, &(entlist->cef_ent), entries_list) {          TAILQ_FOREACH(line, &(entlist->cef_ent), entries_list) {
                 ent = cvs_ent_parse(line->buf);                  ent = cvs_ent_parse(line->buf);
   
                 l = snprintf(fpath, MAXPATHLEN, "%s/%s", cf->file_path,                  (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s", cf->file_path,
                     ent->ce_name);                      ent->ce_name);
                 if (l == -1 || l >= MAXPATHLEN)  
                         fatal("cvs_file_walkdir: overflow");  
   
                 if (!(cr->flags & CR_RECURSE_DIRS) &&                  if (!(cr->flags & CR_RECURSE_DIRS) &&
                     ent->ce_type == CVS_ENT_DIR)                      ent->ce_type == CVS_ENT_DIR)
Line 564 
Line 549 
         size_t len;          size_t len;
         struct stat st;          struct stat st;
         BUF *b1, *b2;          BUF *b1, *b2;
         int rflags, l, ismodified, rcsdead;          int rflags, ismodified, rcsdead;
         CVSENTRIES *entlist = NULL;          CVSENTRIES *entlist = NULL;
         const char *state;          const char *state;
         char repo[MAXPATHLEN], rcsfile[MAXPATHLEN], r1[16], r2[16];          char repo[MAXPATHLEN], rcsfile[MAXPATHLEN], r1[16], r2[16];
Line 577 
Line 562 
         }          }
   
         cvs_get_repository_path(cf->file_wd, repo, MAXPATHLEN);          cvs_get_repository_path(cf->file_wd, repo, MAXPATHLEN);
         l = snprintf(rcsfile, MAXPATHLEN, "%s/%s",          (void)xsnprintf(rcsfile, MAXPATHLEN, "%s/%s",
             repo, cf->file_name);              repo, cf->file_name);
         if (l == -1 || l >= MAXPATHLEN)  
                 fatal("cvs_file_classify: overflow");  
   
         if (cf->file_type == CVS_FILE) {          if (cf->file_type == CVS_FILE) {
                 len = strlcat(rcsfile, RCS_FILE_EXT, MAXPATHLEN);                  len = strlcat(rcsfile, RCS_FILE_EXT, MAXPATHLEN);
Line 634 
Line 617 
                         fatal("cvs_file_classify: failed to parse RCS");                          fatal("cvs_file_classify: failed to parse RCS");
                 cf->file_rcs->rf_inattic = 0;                  cf->file_rcs->rf_inattic = 0;
         } else if (cvs_cmdop != CVS_OP_CHECKOUT) {          } else if (cvs_cmdop != CVS_OP_CHECKOUT) {
                 l = snprintf(rcsfile, MAXPATHLEN, "%s/%s/%s%s",                  (void)xsnprintf(rcsfile, MAXPATHLEN, "%s/%s/%s%s",
                     repo, CVS_PATH_ATTIC, cf->file_name, RCS_FILE_EXT);                      repo, CVS_PATH_ATTIC, cf->file_name, RCS_FILE_EXT);
                 if (l == -1 || l >= MAXPATHLEN)  
                         fatal("cvs_file_classify: overflow");  
   
                 cf->repo_fd = open(rcsfile, O_RDONLY);                  cf->repo_fd = open(rcsfile, O_RDONLY);
                 if (cf->repo_fd != -1) {                  if (cf->repo_fd != -1) {

Legend:
Removed from v.1.182  
changed lines
  Added in v.1.183