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

Diff for /src/usr.bin/cvs/add.c between version 1.30 and 1.31

version 1.30, 2005/09/15 17:01:10 version 1.31, 2005/09/21 16:30:03
Line 158 
Line 158 
   
         added = 0;          added = 0;
   
         if (cf->cf_type == DT_DIR) {          if (cf->cf_type == DT_DIR)
                 if (cvs_add_directory(cf) == -1)                  return cvs_add_directory(cf);
                         return (CVS_EX_FILE);  
                 return (0);  
         }  
   
         if ((!(cf->cf_flags & CVS_FILE_ONDISK)) &&          if ((!(cf->cf_flags & CVS_FILE_ONDISK)) &&
             (cf->cf_cvstat != CVS_FST_LOST) &&              (cf->cf_cvstat != CVS_FST_LOST) &&
Line 242 
Line 239 
         repo = CVS_DIR_REPO(cf);          repo = CVS_DIR_REPO(cf);
   
         if (strlcpy(fpath, cf->cf_name, sizeof(fpath)) >= sizeof(fpath))          if (strlcpy(fpath, cf->cf_name, sizeof(fpath)) >= sizeof(fpath))
                 return (-1);                  return (CVS_EX_DATA);
   
         if (strchr(fpath, '/') != NULL) {          if (strchr(fpath, '/') != NULL) {
                 cvs_log(LP_ERR,                  cvs_log(LP_ERR,
                     "directory %s not added; must be a direct sub-directory",                      "directory %s not added; must be a direct sub-directory",
                     fpath);                      fpath);
                 return (-1);                  return (CVS_EX_FILE);
         }          }
   
         /* Let's see if we have any per-directory tags first */          /* Let's see if we have any per-directory tags first */
Line 261 
Line 258 
         if (l == -1 || l >= (int)sizeof(rcsdir)) {          if (l == -1 || l >= (int)sizeof(rcsdir)) {
                 errno = ENAMETOOLONG;                  errno = ENAMETOOLONG;
                 cvs_log(LP_ERRNO, "%s", rcsdir);                  cvs_log(LP_ERRNO, "%s", rcsdir);
                 return (-1);                  return (CVS_EX_DATA);
         }          }
   
         if ((stat(rcsdir, &st) == 0) && !(S_ISDIR(st.st_mode))) {          if ((stat(rcsdir, &st) == 0) && !(S_ISDIR(st.st_mode))) {
                 cvs_log(LP_ERRNO,                  cvs_log(LP_ERRNO,
                     "%s is not a directory; %s not added", rcsdir, fpath);                      "%s is not a directory; %s not added", rcsdir, fpath);
                 return (-1);                  return (CVS_EX_FILE);
         }          }
   
         snprintf(msg, sizeof(msg),          snprintf(msg, sizeof(msg),
Line 288 
Line 285 
         if (cvs_noexec == 0) {          if (cvs_noexec == 0) {
                 if (mkdir(rcsdir, 0777) == -1) {                  if (mkdir(rcsdir, 0777) == -1) {
                         cvs_log(LP_ERRNO, "failed to create %s", rcsdir);                          cvs_log(LP_ERRNO, "failed to create %s", rcsdir);
                         return (-1);                          return (CVS_EX_FILE);
                 }                  }
         }          }
   
         /* create CVS/ admin files */          /* create CVS/ admin files */
         if (cvs_noexec == 0)          if (cvs_noexec == 0)
                 if (cvs_mkadmin(fpath, root->cr_str, repo, tag, date, nb) == -1)                  if (cvs_mkadmin(fpath, root->cr_str, repo, tag, date, nb) == -1)
                         return (-1);                          return (CVS_EX_FILE);
   
         /* XXX Build the Entries line. */          /* XXX Build the Entries line. */
         l = snprintf(entry, sizeof(entry), "D/%s////", fpath);          l = snprintf(entry, sizeof(entry), "D/%s////", fpath);
         if (l == -1 || l >= (int)sizeof(entry)) {          if (l == -1 || l >= (int)sizeof(entry)) {
                 errno = ENAMETOOLONG;                  errno = ENAMETOOLONG;
                 cvs_log(LP_ERRNO, "%s", entry);                  cvs_log(LP_ERRNO, "%s", entry);
                 return (-1);                  return (CVS_EX_DATA);
         }          }
   
         if ((ent = cvs_ent_parse(entry)) == NULL) {          if ((ent = cvs_ent_parse(entry)) == NULL) {
                 cvs_log(LP_ERR, "failed to parse entry");                  cvs_log(LP_ERR, "failed to parse entry");
                 return (-1);                  return (CVS_EX_DATA);
         }          }
   
         if (cvs_ent_add(entf, ent) < 0) {          if (cvs_ent_add(entf, ent) < 0) {
                 cvs_log(LP_ERR, "failed to add entry");                  cvs_log(LP_ERR, "failed to add entry");
                 return (-1);                  return (CVS_EX_DATA);
         }          }
   
         cvs_printf("%s", msg);          cvs_printf("%s", msg);

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