diff --git a/contrib/cvs/src/cvs.h b/contrib/cvs/src/cvs.h index 20a4c9fd1b43..8079e30b72a3 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 f84eccf1852c..1ff6864e4d77 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 df2d9bfd61de..d0a7059f39e2 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 432e9f924d42..bc3f4d2577f4 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));