summaryrefslogtreecommitdiffstats
path: root/contrib/cvs/src
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-05-17 14:01:25 +0000
committerpeter <peter@FreeBSD.org>1997-05-17 14:01:25 +0000
commit2b6097ead395b5f74ff086294c4f98df30336c06 (patch)
tree20e081b488e9845cd7a367a561ed9494f233c0e6 /contrib/cvs/src
parent4ad318b32399144ef4e0cb771bdc202bb9cbdb12 (diff)
downloadFreeBSD-src-2b6097ead395b5f74ff086294c4f98df30336c06.zip
FreeBSD-src-2b6097ead395b5f74ff086294c4f98df30336c06.tar.gz
Pull in OpenBSD's support for checking out from a read-only repository,
such as within an anoncvs server, or from a CDROM repository. Cyclic (the cvs maintainers) do not like this approach and have an alternative read-only system, but that requires a read/write repository to work (which rules out CDROM). Obtained from: OpenBSD
Diffstat (limited to 'contrib/cvs/src')
-rw-r--r--contrib/cvs/src/cvs.h3
-rw-r--r--contrib/cvs/src/lock.c2
-rw-r--r--contrib/cvs/src/main.c7
-rw-r--r--contrib/cvs/src/server.c2
4 files changed, 11 insertions, 3 deletions
diff --git a/contrib/cvs/src/cvs.h b/contrib/cvs/src/cvs.h
index 20a4c9f..8079e30 100644
--- a/contrib/cvs/src/cvs.h
+++ b/contrib/cvs/src/cvs.h
@@ -256,6 +256,8 @@ extern int errno;
#define CVSREAD_ENV "CVSREAD" /* make files read-only */
#define CVSREAD_DFLT FALSE /* writable files by default */
+#define CVSREADONLYFS_ENV "CVSREADONLYFS" /* repository is read-only */
+
#define RCSBIN_ENV "RCSBIN" /* RCS binary directory */
/* #define RCSBIN_DFLT Set by options.h */
@@ -379,6 +381,7 @@ extern char *CVSroot_directory; /* the directory name */
extern int trace; /* Show all commands */
extern int noexec; /* Don't modify disk anywhere */
+extern int readonlyfs; /* fail on all write locks; succeed all read locks */
extern int logoff; /* Don't write history entry */
#ifdef AUTH_SERVER_SUPPORT
diff --git a/contrib/cvs/src/lock.c b/contrib/cvs/src/lock.c
index f84eccf..1ff6864 100644
--- a/contrib/cvs/src/lock.c
+++ b/contrib/cvs/src/lock.c
@@ -243,7 +243,7 @@ Reader_Lock (xrepository)
FILE *fp;
char *tmp;
- if (noexec)
+ if (noexec || readonlyfs)
return (0);
/* we only do one directory at a time for read locks! */
diff --git a/contrib/cvs/src/main.c b/contrib/cvs/src/main.c
index df2d9bf..d0a7059 100644
--- a/contrib/cvs/src/main.c
+++ b/contrib/cvs/src/main.c
@@ -40,6 +40,7 @@ int really_quiet = FALSE;
int quiet = FALSE;
int trace = FALSE;
int noexec = FALSE;
+int readonlyfs = FALSE;
int logoff = FALSE;
mode_t cvsumask = UMASK_DFLT;
@@ -399,6 +400,10 @@ main (argc, argv)
}
if (getenv (CVSREAD_ENV) != NULL)
cvswrite = FALSE;
+ if (getenv (CVSREADONLYFS_ENV) != NULL) {
+ readonlyfs = TRUE;
+ logoff = TRUE;
+ }
/* I'm not sure whether this needs to be 1 instead of 0 anymore. Using
1 used to accomplish what passing "+" as the first character to
@@ -729,7 +734,7 @@ main (argc, argv)
}
(void) strcat (path, "/");
(void) strcat (path, CVSROOTADM_HISTORY);
- if (isfile (path) && !isaccessible (path, R_OK | W_OK))
+ if (readonlyfs == 0 && isfile (path) && !isaccessible (path, R_OK | W_OK))
{
save_errno = errno;
error (0, 0, "Sorry, you don't have read/write access to the history file");
diff --git a/contrib/cvs/src/server.c b/contrib/cvs/src/server.c
index 432e9f9..bc3f4d2 100644
--- a/contrib/cvs/src/server.c
+++ b/contrib/cvs/src/server.c
@@ -543,7 +543,7 @@ serve_root (arg)
}
(void) strcat (path, "/");
(void) strcat (path, CVSROOTADM_HISTORY);
- if (isfile (path) && !isaccessible (path, R_OK | W_OK))
+ if (readonlyfs == 0 && isfile (path) && !isaccessible (path, R_OK | W_OK))
{
save_errno = errno;
pending_error_text = malloc (80 + strlen (path));
OpenPOWER on IntegriCloud