[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.12 and 1.13

version 1.12, 2004/11/10 22:27:31 version 1.13, 2004/11/26 16:23:50
Line 29 
Line 29 
 #include <sys/wait.h>  #include <sys/wait.h>
   
 #include <md5.h>  #include <md5.h>
 #include <err.h>  
 #include <errno.h>  #include <errno.h>
 #include <fcntl.h>  #include <fcntl.h>
 #include <stdio.h>  #include <stdio.h>
Line 468 
Line 467 
  */   */
   
 int  int
 cvs_mkadmin(struct cvs_file *cdir, mode_t mode)  cvs_mkadmin(CVSFILE *cdir, mode_t mode)
 {  {
         char path[MAXPATHLEN];          char dpath[MAXPATHLEN], path[MAXPATHLEN];
         FILE *fp;          FILE *fp;
         CVSENTRIES *ef;          CVSENTRIES *ef;
         struct stat st;          struct stat st;
         struct cvsroot *root;          struct cvsroot *root;
   
         snprintf(path, sizeof(path), "%s/" CVS_PATH_CVSDIR, cdir->cf_path);          cvs_file_getpath(cdir, dpath, sizeof(dpath));
   
           snprintf(path, sizeof(path), "%s/" CVS_PATH_CVSDIR, dpath);
         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);
         }          }
   
         /* just create an empty Entries file */          /* just create an empty Entries file */
         ef = cvs_ent_open(cdir->cf_path, O_WRONLY);          ef = cvs_ent_open(dpath, O_WRONLY);
         (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, cdir->cf_path);          snprintf(path, sizeof(path), "%s/" CVS_PATH_ROOTSPEC, dpath);
         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 513 
Line 514 
                 (void)fclose(fp);                  (void)fclose(fp);
         }          }
   
         snprintf(path, sizeof(path), "%s/" CVS_PATH_REPOSITORY, cdir->cf_path);          snprintf(path, sizeof(path), "%s/" CVS_PATH_REPOSITORY, dpath);
         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");
Line 544 
Line 545 
                 return (-1);                  return (-1);
         } else if (pid == 0) {          } else if (pid == 0) {
                 execvp(argv[0], argv);                  execvp(argv[0], argv);
                 err(1, "failed to exec %s", argv[0]);                  cvs_log(LP_ERRNO, "failed to exec %s", argv[0]);
                   exit(1);
         }          }
   
         if (waitpid(pid, &ret, 0) == -1)          if (waitpid(pid, &ret, 0) == -1)
                 warn("failed to waitpid");                  cvs_log(LP_ERRNO, "failed to waitpid");
   
         return (ret);          return (ret);
 }  }

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13