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

Diff for /src/usr.bin/cvs/util.c between version 1.20 and 1.21

version 1.20, 2004/12/22 00:38:26 version 1.21, 2005/04/16 18:07:35
Line 94 
Line 94 
 int  int
 cvs_readrepo(const char *dir, char *dst, size_t len)  cvs_readrepo(const char *dir, char *dst, size_t len)
 {  {
           int l;
         size_t dlen;          size_t dlen;
         FILE *fp;          FILE *fp;
         char repo_path[MAXPATHLEN];          char repo_path[MAXPATHLEN];
   
         snprintf(repo_path, sizeof(repo_path), "%s/CVS/Repository", dir);          l = snprintf(repo_path, sizeof(repo_path), "%s/CVS/Repository", dir);
           if (l == -1 || l >= (int)sizeof(repo_path)) {
                   errno = ENAMETOOLONG;
                   cvs_log(LP_ERRNO, "%s", repo_path);
                   return (NULL);
           }
   
         fp = fopen(repo_path, "r");          fp = fopen(repo_path, "r");
         if (fp == NULL) {          if (fp == NULL)
                 return (-1);                  return (-1);
         }  
   
         if (fgets(dst, (int)len, fp) == NULL) {          if (fgets(dst, (int)len, fp) == NULL) {
                 if (ferror(fp)) {                  if (ferror(fp)) {
Line 495 
Line 501 
 int  int
 cvs_mkadmin(CVSFILE *cdir, mode_t mode)  cvs_mkadmin(CVSFILE *cdir, mode_t mode)
 {  {
           int l;
         char dpath[MAXPATHLEN], path[MAXPATHLEN];          char dpath[MAXPATHLEN], path[MAXPATHLEN];
         FILE *fp;          FILE *fp;
         CVSENTRIES *ef;          CVSENTRIES *ef;
Line 503 
Line 510 
   
         cvs_file_getpath(cdir, dpath, sizeof(dpath));          cvs_file_getpath(cdir, dpath, sizeof(dpath));
   
         snprintf(path, sizeof(path), "%s/" CVS_PATH_CVSDIR, dpath);          l = snprintf(path, sizeof(path), "%s/" CVS_PATH_CVSDIR, dpath);
           if (l == -1 || l >= (int)sizeof(path)) {
                   errno = ENAMETOOLONG;
                   cvs_log(LP_ERRNO, "%s", path);
                   return (-1);
           }
   
         if ((mkdir(path, mode) == -1) && (errno != EEXIST)) {          if ((mkdir(path, mode) == -1) && (errno != EEXIST)) {
                 cvs_log(LP_ERRNO, "failed to create directory %s", path);                  cvs_log(LP_ERRNO, "failed to create directory %s", path);
                 return (-1);                  return (-1);
Line 514 
Line 527 
         (void)cvs_ent_close(ef);          (void)cvs_ent_close(ef);
   
         root = cdir->cf_ddat->cd_root;          root = cdir->cf_ddat->cd_root;
         snprintf(path, sizeof(path), "%s/" CVS_PATH_ROOTSPEC, dpath);          l = snprintf(path, sizeof(path), "%s/" CVS_PATH_ROOTSPEC, dpath);
           if (l == -1 || l >= (int)sizeof(path)) {
                   errno = ENAMETOOLONG;
                   cvs_log(LP_ERRNO, "%s", path);
                   return (-1);
           }
   
         if ((root != NULL) && (stat(path, &st) != 0) && (errno == ENOENT)) {          if ((root != NULL) && (stat(path, &st) != 0) && (errno == ENOENT)) {
                 fp = fopen(path, "w");                  fp = fopen(path, "w");
                 if (fp == NULL) {                  if (fp == NULL) {
Line 541 
Line 560 
         }          }
   
         snprintf(path, sizeof(path), "%s/" CVS_PATH_REPOSITORY, dpath);          snprintf(path, sizeof(path), "%s/" CVS_PATH_REPOSITORY, dpath);
           if (l == -1 || l >= (int)sizeof(path)) {
                   errno = ENAMETOOLONG;
                   cvs_log(LP_ERRNO, "%s", path);
                   return (-1);
           }
   
         if ((stat(path, &st) != 0) && (errno == ENOENT) &&          if ((stat(path, &st) != 0) && (errno == ENOENT) &&
             (cdir->cf_ddat->cd_repo != NULL)) {              (cdir->cf_ddat->cd_repo != NULL)) {
                 fp = fopen(path, "w");                  fp = fopen(path, "w");

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21