=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/Attic/resp.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- src/usr.bin/cvs/Attic/resp.c 2005/05/20 19:58:03 1.35 +++ src/usr.bin/cvs/Attic/resp.c 2005/05/24 03:06:16 1.36 @@ -1,4 +1,4 @@ -/* $OpenBSD: resp.c,v 1.35 2005/05/20 19:58:03 xsa Exp $ */ +/* $OpenBSD: resp.c,v 1.36 2005/05/24 03:06:16 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. @@ -333,11 +333,22 @@ { int fd, len; char rpath[MAXPATHLEN], statpath[MAXPATHLEN]; + struct stat dst; /* remote directory line */ if (cvs_getln(root, rpath, sizeof(rpath)) < 0) return (-1); + STRIP_SLASH(line); + + /* if the directory doesn't exist, first create it */ + if ((stat(line, &dst) == -1) && (errno == ENOENT)) { + if (mkdir(line, 0755) == -1) { + cvs_log(LP_ERRNO, "failed to create %s", line); + return (-1); + } + } + len = snprintf(statpath, sizeof(statpath), "%s/%s", line, CVS_PATH_STATICENTRIES); if (len == -1 || len >= (int)sizeof(statpath)) { @@ -380,6 +391,7 @@ { char buf[MAXPATHLEN], subdir[MAXPATHLEN], *file; struct cvs_ent *ent; + struct stat dst; CVSFILE *cf, *sdir; CVSENTRIES *entf; @@ -388,6 +400,14 @@ return (-1); STRIP_SLASH(line); + + /* if the directory doesn't exist, first create it */ + if ((stat(line, &dst) == -1) && (errno == ENOENT)) { + if (mkdir(line, 0755) == -1) { + cvs_log(LP_ERRNO, "failed to create %s", line); + return (-1); + } + } cvs_splitpath(line, subdir, sizeof(subdir), &file); sdir = cvs_file_find(cvs_files, subdir);