=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/util.c,v retrieving revision 1.12 retrieving revision 1.13 diff -c -r1.12 -r1.13 *** src/usr.bin/cvs/util.c 2004/11/10 22:27:31 1.12 --- src/usr.bin/cvs/util.c 2004/11/26 16:23:50 1.13 *************** *** 1,4 **** ! /* $OpenBSD: util.c,v 1.12 2004/11/10 22:27:31 krapht Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: util.c,v 1.13 2004/11/26 16:23:50 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. *************** *** 29,35 **** #include #include - #include #include #include #include --- 29,34 ---- *************** *** 468,493 **** */ int ! cvs_mkadmin(struct cvs_file *cdir, mode_t mode) { ! char path[MAXPATHLEN]; FILE *fp; CVSENTRIES *ef; struct stat st; struct cvsroot *root; ! snprintf(path, sizeof(path), "%s/" CVS_PATH_CVSDIR, cdir->cf_path); if ((mkdir(path, mode) == -1) && (errno != EEXIST)) { cvs_log(LP_ERRNO, "failed to create directory %s", path); return (-1); } /* just create an empty Entries file */ ! ef = cvs_ent_open(cdir->cf_path, O_WRONLY); (void)cvs_ent_close(ef); root = cdir->cf_ddat->cd_root; ! snprintf(path, sizeof(path), "%s/" CVS_PATH_ROOTSPEC, cdir->cf_path); if ((root != NULL) && (stat(path, &st) != 0) && (errno == ENOENT)) { fp = fopen(path, "w"); if (fp == NULL) { --- 467,494 ---- */ int ! cvs_mkadmin(CVSFILE *cdir, mode_t mode) { ! char dpath[MAXPATHLEN], path[MAXPATHLEN]; FILE *fp; CVSENTRIES *ef; struct stat st; struct cvsroot *root; ! cvs_file_getpath(cdir, dpath, sizeof(dpath)); ! ! snprintf(path, sizeof(path), "%s/" CVS_PATH_CVSDIR, dpath); if ((mkdir(path, mode) == -1) && (errno != EEXIST)) { cvs_log(LP_ERRNO, "failed to create directory %s", path); return (-1); } /* just create an empty Entries file */ ! ef = cvs_ent_open(dpath, O_WRONLY); (void)cvs_ent_close(ef); root = cdir->cf_ddat->cd_root; ! snprintf(path, sizeof(path), "%s/" CVS_PATH_ROOTSPEC, dpath); if ((root != NULL) && (stat(path, &st) != 0) && (errno == ENOENT)) { fp = fopen(path, "w"); if (fp == NULL) { *************** *** 513,519 **** (void)fclose(fp); } ! snprintf(path, sizeof(path), "%s/" CVS_PATH_REPOSITORY, cdir->cf_path); if ((stat(path, &st) != 0) && (errno == ENOENT) && (cdir->cf_ddat->cd_repo != NULL)) { fp = fopen(path, "w"); --- 514,520 ---- (void)fclose(fp); } ! snprintf(path, sizeof(path), "%s/" CVS_PATH_REPOSITORY, dpath); if ((stat(path, &st) != 0) && (errno == ENOENT) && (cdir->cf_ddat->cd_repo != NULL)) { fp = fopen(path, "w"); *************** *** 544,554 **** return (-1); } else if (pid == 0) { execvp(argv[0], argv); ! err(1, "failed to exec %s", argv[0]); } if (waitpid(pid, &ret, 0) == -1) ! warn("failed to waitpid"); return (ret); } --- 545,556 ---- return (-1); } else if (pid == 0) { execvp(argv[0], argv); ! cvs_log(LP_ERRNO, "failed to exec %s", argv[0]); ! exit(1); } if (waitpid(pid, &ret, 0) == -1) ! cvs_log(LP_ERRNO, "failed to waitpid"); return (ret); }