summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2002-12-02 03:17:49 +0000
committerpeter <peter@FreeBSD.org>2002-12-02 03:17:49 +0000
commitce098c03a4ea1271a5a9049e36dc2252a6de5fb2 (patch)
treed5416c787fc483c91bdc8a2162dc489b0e1c08d9 /contrib
parentc88e7301411c002ff913342f1619967f7c3b58e7 (diff)
downloadFreeBSD-src-ce098c03a4ea1271a5a9049e36dc2252a6de5fb2.zip
FreeBSD-src-ce098c03a4ea1271a5a9049e36dc2252a6de5fb2.tar.gz
Merge 1.11.2 -> 1.11.2.1-20021201 changes onto mainline
Approved by: re
Diffstat (limited to 'contrib')
-rw-r--r--contrib/cvs/acconfig.h50
-rw-r--r--contrib/cvs/lib/fnmatch.h40
-rw-r--r--contrib/cvs/lib/hostname.c45
-rw-r--r--contrib/cvs/src/buffer.c16
-rw-r--r--contrib/cvs/src/checkout.c2
-rw-r--r--contrib/cvs/src/client.c35
-rw-r--r--contrib/cvs/src/commit.c54
-rw-r--r--contrib/cvs/src/cvs.h33
-rw-r--r--contrib/cvs/src/diff.c5
-rw-r--r--contrib/cvs/src/filesubr.c46
-rw-r--r--contrib/cvs/src/import.c13
-rw-r--r--contrib/cvs/src/lock.c105
-rw-r--r--contrib/cvs/src/login.c16
-rw-r--r--contrib/cvs/src/logmsg.c107
-rw-r--r--contrib/cvs/src/main.c21
-rw-r--r--contrib/cvs/src/options.h.in200
-rw-r--r--contrib/cvs/src/rcs.c29
-rw-r--r--contrib/cvs/src/rcscmds.c52
-rw-r--r--contrib/cvs/src/recurse.c34
-rw-r--r--contrib/cvs/src/server.c178
-rw-r--r--contrib/cvs/src/stamp-h2.in1
-rw-r--r--contrib/cvs/src/update.c90
-rw-r--r--contrib/cvs/src/version.h.in15
-rw-r--r--contrib/cvs/stamp-h1.in1
24 files changed, 420 insertions, 768 deletions
diff --git a/contrib/cvs/acconfig.h b/contrib/cvs/acconfig.h
deleted file mode 100644
index de9d379..0000000
--- a/contrib/cvs/acconfig.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Define if you have MIT Kerberos version 4 available. */
-#undef HAVE_KERBEROS
-
-/* Define if you want CVS to be able to be a remote repository client. */
-#undef CLIENT_SUPPORT
-
-/* Define if you want CVS to be able to serve repositories to remote
- clients. */
-#undef SERVER_SUPPORT
-
-/* Define if you want to use the password authenticated server. */
-#undef AUTH_SERVER_SUPPORT
-
-/* Define if you want encryption support. */
-#undef ENCRYPTION
-
-/* Define if you have the connect function. */
-#undef HAVE_CONNECT
-
-/* Define if this system supports chown(), link(), and friends. */
-#undef PRESERVE_PERMISSIONS_SUPPORT
-
-/* Define if you have memchr (always for CVS). */
-#undef HAVE_MEMCHR
-
-/* Define if you have strchr (always for CVS). */
-#undef HAVE_STRCHR
-
-/* Define if utime requires write access to the file (true on Windows,
- but not Unix). */
-#undef UTIME_EXPECTS_WRITABLE
-
-/* Define if setmode is required when writing binary data to stdout. */
-#undef USE_SETMODE_STDOUT
-
-/* Define if the diff library should use setmode for binary files.
- FIXME: Why two different macros for setmode? */
-#undef HAVE_SETMODE
-
-/* Define if you have the crypt function. */
-#undef HAVE_CRYPT
-
-/* Define if you have the getspnam function. */
-#undef HAVE_GETSPNAM
-
-/* Define to force lib/regex.c to use malloc instead of alloca. */
-#undef REGEX_MALLOC
-
-/* Define to force lib/regex.c to define re_comp et al. */
-#undef _REGEX_RE_COMP
diff --git a/contrib/cvs/lib/fnmatch.h b/contrib/cvs/lib/fnmatch.h
deleted file mode 100644
index b157347..0000000
--- a/contrib/cvs/lib/fnmatch.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 1992 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details. */
-
-#ifndef _FNMATCH_H
-
-#define _FNMATCH_H 1
-
-/* Bits set in the FLAGS argument to `fnmatch'. */
-#undef FNM_PATHNAME
-#define FNM_PATHNAME (1 << 0)/* No wildcard can ever match `/'. */
-#undef FNM_NOESCAPE
-#define FNM_NOESCAPE (1 << 1)/* Backslashes don't quote special chars. */
-#undef FNM_PERIOD
-#define FNM_PERIOD (1 << 2)/* Leading `.' is matched only explicitly. */
-#undef __FNM_FLAGS
-#define __FNM_FLAGS (FNM_PATHNAME|FNM_NOESCAPE|FNM_PERIOD)
-
-/* Value returned by `fnmatch' if STRING does not match PATTERN. */
-#undef FNM_NOMATCH
-#define FNM_NOMATCH 1
-
-/* Match STRING against the filename pattern PATTERN,
- returning zero if it matches, FNM_NOMATCH if not. */
-#if __STDC__
-extern int fnmatch (const char *pattern, const char *string, int flags);
-#else
-extern int fnmatch ();
-#endif
-
-#endif /* fnmatch.h */
diff --git a/contrib/cvs/lib/hostname.c b/contrib/cvs/lib/hostname.c
deleted file mode 100644
index 7fde534..0000000
--- a/contrib/cvs/lib/hostname.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* hostname.c -- use uname() to get the name of the host
- Copyright (C) 1992 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details. */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#if defined(STDC_HEADERS) || defined(USG)
-#include <string.h>
-#ifndef index
-#define index strchr
-#endif
-#else
-#include <strings.h>
-#endif
-
-#include <sys/utsname.h>
-
-/* Put this host's name into NAME, using at most NAMELEN characters */
-
-int
-gethostname(name, namelen)
- char *name;
- int namelen;
-{
- struct utsname ugnm;
-
- if (uname(&ugnm) < 0)
- return (-1);
-
- (void) strncpy(name, ugnm.nodename, namelen-1);
- name[namelen-1] = '\0';
-
- return (0);
-}
diff --git a/contrib/cvs/src/buffer.c b/contrib/cvs/src/buffer.c
index 9048a9e..57f905e 100644
--- a/contrib/cvs/src/buffer.c
+++ b/contrib/cvs/src/buffer.c
@@ -1249,6 +1249,20 @@ stdio_buffer_initialize (fp, child_pid, input, memory)
(void *) bc);
}
+/* Return the file associated with a stdio buffer. */
+FILE *
+stdio_buffer_get_file (buf)
+ struct buffer *buf;
+{
+ struct stdio_buffer_closure *bc;
+
+ assert(buf->shutdown == stdio_buffer_shutdown);
+
+ bc = (struct stdio_buffer_closure *) buf->closure;
+
+ return(bc->fp);
+}
+
/* The buffer input function for a buffer built on a stdio FILE. */
static int
@@ -1380,7 +1394,7 @@ stdio_buffer_shutdown (buf)
if (buf->input)
{
- if (! buf_empty_p (buf))
+ if ( !buf_empty_p (buf) )
{
# ifdef SERVER_SUPPORT
if (server_active)
diff --git a/contrib/cvs/src/checkout.c b/contrib/cvs/src/checkout.c
index 0748988..6c0bba8 100644
--- a/contrib/cvs/src/checkout.c
+++ b/contrib/cvs/src/checkout.c
@@ -466,7 +466,7 @@ safe_location (where)
char *parent;
/* strip the last_component */
- where_location = strdup( where );
+ where_location = xstrdup( where );
parent = last_component( where_location );
parent[-1] = '\0';
diff --git a/contrib/cvs/src/client.c b/contrib/cvs/src/client.c
index 1fffbdb..50505da 100644
--- a/contrib/cvs/src/client.c
+++ b/contrib/cvs/src/client.c
@@ -251,7 +251,8 @@ arg_should_not_be_sent_to_server (arg)
{
/* We're at the beginning of the string. Look at the
CVSADM files in cwd. */
- this_root = Name_Root ((char *) NULL, (char *) NULL);
+ this_root = (CVSroot_cmdline ? xstrdup(CVSroot_cmdline)
+ : Name_Root ((char *) NULL, (char *) NULL));
}
/* Now check the value for root. */
@@ -1324,6 +1325,9 @@ warning: server is not creating directories one at a time");
if ( CVS_CHDIR (dir_name) < 0)
error (1, errno, "could not chdir to %s", dir_name);
}
+ else if (strcmp (command_name, "export") == 0)
+ /* Don't create CVSADM directories if this is export. */
+ ;
else if (!isdir (CVSADM))
{
/*
@@ -3613,12 +3617,14 @@ get_responses_and_close ()
status = buf_shutdown (to_server);
if (status != 0)
error (0, status, "shutting down buffer to server");
+ buf_free (to_server);
+ to_server = NULL;
+
status = buf_shutdown (from_server);
if (status != 0)
error (0, status, "shutting down buffer from server");
-
- buf_free (to_server);
buf_free (from_server);
+ from_server = NULL;
server_started = 0;
/* see if we need to sleep before returning to avoid time-stamp races */
@@ -3724,14 +3730,18 @@ get_port_number (envname, portname, defaultport)
* we do this here instead of in parse_cvsroot so that we can keep network
* code confined to a localized area and also to delay the lookup until the
* last possible moment so it remains possible to run cvs client commands that
- * skip opening connections to the server (i.e. skip network operations entirely)
+ * skip opening connections to the server (i.e. skip network operations
+ * entirely)
*
- * and yes, I know none of the the commands do that now, but here's to planning
+ * and yes, I know none of the commands do that now, but here's to planning
* for the future, eh? cheers.
*
* FIXME - We could cache the port lookup safely right now as we never change
* it for a single root on the fly, but we'd have to un'const some other
- * functions
+ * functions - REMOVE_FIXME? This may be unecessary. We're talking about,
+ * what, usually one, sometimes two lookups of the port per invocation. I
+ * think twice is by far the rarer of the two cases - only the login function
+ * will need to do it to save the canonical CVSROOT. -DRP
*/
int
get_cvs_port_number (root)
@@ -3911,12 +3921,14 @@ connect_to_pserver (root, to_server_p, from_server_p, verify_only, do_gssapi)
status = buf_shutdown (to_server);
if (status != 0)
error (0, status, "shutting down buffer to server");
+ buf_free (to_server);
+ to_server = NULL;
+
status = buf_shutdown (from_server);
if (status != 0)
error (0, status, "shutting down buffer from server");
-
- buf_free (to_server);
buf_free (from_server);
+ from_server = NULL;
/* Don't need to set server_started = 0 since we don't set it to 1
* until returning from this call.
@@ -3961,10 +3973,11 @@ auth_server (root, lto_server, lfrom_server, verify_only, do_gssapi, hostinfo)
if (do_gssapi)
{
#ifdef HAVE_GSSAPI
- int fd = (int) lto_server->closure;
+ FILE *fp = stdio_buffer_get_file(lto_server);
+ int fd = fp ? fileno(fp) : -1;
struct stat s;
- if (fstat (fd, &s) < 0 || !S_ISSOCK(s.st_mode))
+ if ((fd < 0) || (fstat (fd, &s) < 0) || !S_ISSOCK(s.st_mode))
{
error (1, 0, "gserver currently only enabled for socket connections");
}
@@ -5623,7 +5636,7 @@ send_files (argc, argv, local, aflag, flags)
err = start_recursion
(send_fileproc, send_filesdoneproc,
send_dirent_proc, send_dirleave_proc, (void *) &args,
- argc, argv, local, W_LOCAL, aflag, 0, (char *)NULL, 0);
+ argc, argv, local, W_LOCAL, aflag, LOCK_NONE, (char *)NULL, 0);
if (err)
error_exit ();
if (toplevel_repos == NULL)
diff --git a/contrib/cvs/src/commit.c b/contrib/cvs/src/commit.c
index a951f49..0962354 100644
--- a/contrib/cvs/src/commit.c
+++ b/contrib/cvs/src/commit.c
@@ -251,12 +251,23 @@ find_fileproc (callerdat, finfo)
vers = Version_TS (&xfinfo, NULL, saved_tag, NULL, 0, 0);
if (vers->ts_user == NULL
&& vers->vn_user != NULL
- && vers->vn_user[0] == '-')
- /* FIXME: If vn_user is starts with "-" but ts_user is
- non-NULL, what classify_file does is print "%s should be
- removed and is still there". I'm not sure what it does
- then. We probably should do the same. */
- status = T_REMOVED;
+ && (vers->vn_user[0] == '0' || vers->vn_user[0] == '-'))
+ {
+ if ( vers->vn_user[0] == '0')
+ {
+ /* This happens when one has `cvs add'ed a file, but it no
+ longer exists in the working directory at commit time. */
+ status = T_ADDED;
+ }
+ else
+ {
+ /* FIXME: If vn_user is starts with "-" but ts_user is
+ non-NULL, what classify_file does is print "%s should be
+ removed and is still there". I'm not sure what it does
+ then. We probably should do the same. */
+ status = T_REMOVED;
+ }
+ }
else if (vers->vn_user == NULL)
{
if (vers->ts_user == NULL)
@@ -272,7 +283,8 @@ find_fileproc (callerdat, finfo)
&& vers->vn_user[0] == '0')
/* FIXME: If vn_user is "0" but ts_user is NULL, what classify_file
does is print "new-born %s has disappeared" and removes the entry.
- We probably should do the same. */
+ We probably should do the same. No! Not here. Otherwise, a commit
+ would succeed in some cases when it should fail. See above. */
status = T_ADDED;
else if (vers->ts_user != NULL
&& vers->ts_rcs != NULL
@@ -455,7 +467,7 @@ commit (argc, argv)
err = start_recursion (find_fileproc, find_filesdoneproc,
find_dirent_proc, (DIRLEAVEPROC) NULL,
(void *)&find_args,
- argc, argv, local, W_LOCAL, 0, 0,
+ argc, argv, local, W_LOCAL, 0, LOCK_NONE,
(char *)NULL, 0);
if (err)
error (1, 0, "correct above errors first!");
@@ -498,9 +510,7 @@ commit (argc, argv)
do_editor (".", &saved_message, (char *)NULL, find_args.ulist);
/* We always send some sort of message, even if empty. */
- /* FIXME: is that true? There seems to be some code in do_editor
- which can leave the message NULL. */
- option_with_arg ("-m", saved_message);
+ option_with_arg ("-m", saved_message ? saved_message : "");
/* OK, now process all the questionable files we have been saving
up. */
@@ -550,6 +560,7 @@ commit (argc, argv)
if (!run_module_prog)
send_arg("-n");
option_with_arg ("-r", saved_tag);
+ send_arg ("--");
/* FIXME: This whole find_args.force/SEND_FORCE business is a
kludge. It would seem to be a server bug that we have to
@@ -637,7 +648,8 @@ commit (argc, argv)
*/
err = start_recursion (check_fileproc, check_filesdoneproc,
check_direntproc, (DIRLEAVEPROC) NULL, NULL, argc,
- argv, local, W_LOCAL, aflag, 0, (char *) NULL, 1);
+ argv, local, W_LOCAL, aflag, LOCK_NONE,
+ (char *) NULL, 1);
if (err)
{
Lock_Cleanup ();
@@ -651,7 +663,7 @@ commit (argc, argv)
if (noexec == 0)
err = start_recursion (commit_fileproc, commit_filesdoneproc,
commit_direntproc, commit_dirleaveproc, NULL,
- argc, argv, local, W_LOCAL, aflag, 0,
+ argc, argv, local, W_LOCAL, aflag, LOCK_NONE,
(char *) NULL, 1);
/*
@@ -1221,13 +1233,17 @@ commit_fileproc (callerdat, finfo)
* with files as args from the command line. In that latter case, we
* need to get the commit message ourselves
*/
- if (!(got_message))
+ if (!got_message)
{
got_message = 1;
- if (use_editor)
+ if (
+#ifdef SERVER_SUPPORT
+ !server_active &&
+#endif
+ use_editor)
do_editor (finfo->update_dir, &saved_message,
finfo->repository, ulist);
- do_verify (&saved_message, finfo->repository);
+ do_verify (&saved_message, finfo->repository);
}
p = findnode (cilist, finfo->file);
@@ -1547,7 +1563,11 @@ commit_direntproc (callerdat, dir, repos, update_dir, entries)
/* get commit message */
real_repos = Name_Repository (dir, update_dir);
got_message = 1;
- if (use_editor)
+ if (
+#ifdef SERVER_SUPPORT
+ !server_active &&
+#endif
+ use_editor)
do_editor (update_dir, &saved_message, real_repos, ulist);
do_verify (&saved_message, real_repos);
free (real_repos);
diff --git a/contrib/cvs/src/cvs.h b/contrib/cvs/src/cvs.h
index ac2de4a..fe8c80a 100644
--- a/contrib/cvs/src/cvs.h
+++ b/contrib/cvs/src/cvs.h
@@ -13,7 +13,9 @@
*/
-#include "config.h" /* this is stuff found via autoconf */
+#ifdef HAVE_CONFIG_H
+# include <config.h> /* this is stuff found via autoconf */
+#endif /* CONFIG_H */
#include "options.h" /* these are some larger questions which
can't easily be automatically checked
for */
@@ -65,7 +67,11 @@ extern char *getenv();
char *strerror ();
#endif
-#include <fnmatch.h> /* This is supposed to be available on Posix systems */
+#ifdef HAVE_FNMATCH
+# include <fnmatch.h> /* This is supposed to be available on Posix systems */
+#else /* HAVE_FNMATCH */
+# include "fnmatch.h" /* Our substitute */
+#endif /* HAVE_FNMATCH */
#include <ctype.h>
#include <pwd.h>
@@ -362,6 +368,11 @@ typedef int Dtype;
typedef enum direnter_type Dtype;
#endif
+/* Recursion processor lock types */
+#define LOCK_NONE 0
+#define LOCK_READ 1
+#define LOCK_WRITE 2
+
extern char *program_name, *program_path, *command_name;
extern char *Tmpdir, *Editor;
extern int cvsadmin_root;
@@ -428,10 +439,6 @@ extern int RCS_exec_rcsdiff PROTO ((RCSNode *rcsfile,
extern int diff_exec PROTO ((char *file1, char *file2,
char *label1, char *label2,
char *options, char *out));
-extern int diff_execv PROTO ((char *file1, char *file2,
- char *label1, char *label2,
- char *options, char *out));
-
#include "error.h"
@@ -494,6 +501,7 @@ int isabsolute PROTO((const char *filename));
char *xreadlink PROTO((const char *link));
char *last_component PROTO((char *path));
char *get_homedir PROTO ((void));
+char *strcat_filename_onto_homedir PROTO ((const char *, const char *));
char *cvs_temp_name PROTO ((void));
FILE *cvs_temp_file PROTO ((char **filename));
void parseopts PROTO ((const char *root));
@@ -646,7 +654,7 @@ int start_recursion PROTO((FILEPROC fileproc, FILESDONEPROC filesdoneproc,
DIRENTPROC direntproc, DIRLEAVEPROC dirleaveproc,
void *callerdat,
int argc, char *argv[], int local, int which,
- int aflag, int readlock, char *update_preload,
+ int aflag, int locktype, char *update_preload,
int dosrcs));
void SIG_beginCrSect PROTO((void));
void SIG_endCrSect PROTO((void));
@@ -860,8 +868,17 @@ extern int history PROTO ((int argc, char **argv));
extern int import PROTO ((int argc, char **argv));
extern int cvslog PROTO ((int argc, char **argv));
#ifdef AUTH_CLIENT_SUPPORT
+/* Some systems (namely Mac OS X) have conflicting definitions for these
+ * functions. Avoid them.
+ */
+#ifdef HAVE_LOGIN
+# define login cvs_login
+#endif /* HAVE_LOGIN */
+#ifdef HAVE_LOGOUT
+# define logout cvs_logout
+#endif /* HAVE_LOGOUT */
extern int login PROTO((int argc, char **argv));
-int logout PROTO((int argc, char **argv));
+extern int logout PROTO((int argc, char **argv));
#endif /* AUTH_CLIENT_SUPPORT */
extern int patch PROTO((int argc, char **argv));
extern int release PROTO((int argc, char **argv));
diff --git a/contrib/cvs/src/diff.c b/contrib/cvs/src/diff.c
index be1fb5f..edf1af4 100644
--- a/contrib/cvs/src/diff.c
+++ b/contrib/cvs/src/diff.c
@@ -421,6 +421,7 @@ diff (argc, argv)
option_with_arg ("-r", diff_rev2);
else if (diff_date2)
client_senddate (diff_date2);
+ send_arg ("--");
/* Send the current files unless diffing two revs from the archive */
if (diff_rev2 == NULL && diff_date2 == NULL)
@@ -449,9 +450,9 @@ diff (argc, argv)
/* start the recursion processor */
err = start_recursion (diff_fileproc, diff_filesdoneproc, diff_dirproc,
diff_dirleaveproc, NULL, argc, argv, local,
- which, 0, 1, (char *) NULL, 1);
-
+ which, 0, LOCK_READ, (char *) NULL, 1);
}
+
/* clean up */
free (options);
options = NULL;
diff --git a/contrib/cvs/src/filesubr.c b/contrib/cvs/src/filesubr.c
index 4b163e3..01afa93 100644
--- a/contrib/cvs/src/filesubr.c
+++ b/contrib/cvs/src/filesubr.c
@@ -56,7 +56,7 @@ copy_file (from, to)
if (isdevice (from))
{
-#if defined(HAVE_MKNOD) && defined(HAVE_ST_RDEV)
+#if defined(HAVE_MKNOD) && defined(HAVE_STRUCT_STAT_ST_RDEV)
if (stat (from, &sb) < 0)
error (1, errno, "cannot stat %s", from);
mknod (to, sb.st_mode, sb.st_rdev);
@@ -220,7 +220,7 @@ isaccessible (file, mode)
int umask = 0;
int gmask = 0;
int omask = 0;
- int uid;
+ int uid, mask;
if (stat(file, &sb) == -1)
return 0;
@@ -230,10 +230,11 @@ isaccessible (file, mode)
uid = geteuid();
if (uid == 0) /* superuser */
{
- if (mode & X_OK)
- return sb.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH);
- else
+ if (!(mode & X_OK) || (sb.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)))
return 1;
+
+ errno = EACCES;
+ return 0;
}
if (mode & R_OK)
@@ -255,12 +256,11 @@ isaccessible (file, mode)
omask |= S_IXOTH;
}
- if (sb.st_uid == uid)
- return (sb.st_mode & umask) == umask;
- else if (sb.st_gid == getegid())
- return (sb.st_mode & gmask) == gmask;
- else
- return (sb.st_mode & omask) == omask;
+ mask = sb.st_uid == uid ? umask : sb.st_gid == getegid() ? gmask : omask;
+ if ((sb.st_mode & mask) == mask)
+ return 1;
+ errno = EACCES;
+ return 0;
#else
return access(file, mode) == 0;
#endif
@@ -628,7 +628,7 @@ xcmp (file1, file2)
numbers match. */
if (S_ISBLK (sb1.st_mode) || S_ISCHR (sb1.st_mode))
{
-#ifdef HAVE_ST_RDEV
+#ifdef HAVE_STRUCT_STAT_ST_RDEV
if (sb1.st_rdev == sb2.st_rdev)
return 0;
else
@@ -958,6 +958,26 @@ get_homedir ()
return home;
}
+/* Compose a path to a file in the home directory. This is necessary because
+ * of different behavior on UNIX and VMS. See the notes in vms/filesubr.c.
+ *
+ * A more clean solution would be something more along the lines of a
+ * "join a directory to a filename" kind of thing which was not specific to
+ * the homedir. This should aid portability between UNIX, Mac, Windows, VMS,
+ * and possibly others. This is already handled by Perl - it might be
+ * interesting to see how much of the code was written in C since Perl is under
+ * the GPL and the Artistic license - we might be able to use it.
+ */
+char *
+strcat_filename_onto_homedir (dir, file)
+ const char *dir;
+ const char *file;
+{
+ char *path = xmalloc (strlen (dir) + 1 + strlen(file) + 1);
+ sprintf (path, "%s/%s", dir, file);
+ return path;
+}
+
/* See cvs.h for description. On unix this does nothing, because the
shell expands the wildcards. */
void
@@ -1102,3 +1122,5 @@ fopen_case (name, mode, fp, pathp)
return retval;
}
#endif /* SERVER_SUPPORT */
+/* vim:tabstop=8:shiftwidth=4
+ */
diff --git a/contrib/cvs/src/import.c b/contrib/cvs/src/import.c
index 09ed285..5206d0e 100644
--- a/contrib/cvs/src/import.c
+++ b/contrib/cvs/src/import.c
@@ -218,7 +218,11 @@ import (argc, argv)
}
#endif
- if (use_editor)
+ if (
+#ifdef SERVER_SUPPORT
+ !server_active &&
+#endif
+ use_editor)
{
do_editor ((char *) NULL, &message,
#ifdef CLIENT_SUPPORT
@@ -249,8 +253,7 @@ import (argc, argv)
if (vbranch[0] != '\0')
option_with_arg ("-b", vbranch);
- if (message)
- option_with_arg ("-m", message);
+ option_with_arg ("-m", message ? message : "");
if (keyword_opt != NULL)
option_with_arg ("-k", keyword_opt);
/* The only ignore processing which takes place on the server side
@@ -1227,7 +1230,7 @@ add_rcs_file (message, rcs, user, add_vhead, key_opt,
case S_IFREG: break;
case S_IFCHR:
case S_IFBLK:
-#ifdef HAVE_ST_RDEV
+#ifdef HAVE_STRUCT_STAT_ST_RDEV
if (fprintf (fprcs, "special\t%s %lu;\012",
(file_type == S_IFCHR
? "character"
@@ -1284,7 +1287,7 @@ userfile);
case S_IFREG: break;
case S_IFCHR:
case S_IFBLK:
-#ifdef HAVE_ST_RDEV
+#ifdef HAVE_STRUCT_STAT_ST_RDEV
if (fprintf (fprcs, "special\t%s %lu;\012",
(file_type == S_IFCHR
? "character"
diff --git a/contrib/cvs/src/lock.c b/contrib/cvs/src/lock.c
index c287201..4ade82c 100644
--- a/contrib/cvs/src/lock.c
+++ b/contrib/cvs/src/lock.c
@@ -642,64 +642,66 @@ readers_exist (repository)
DIR *dirp;
struct dirent *dp;
struct stat sb;
- int ret = 0;
-
+ int ret;
#ifdef CVS_FUDGELOCKS
-again:
+ time_t now;
+ (void) time (&now);
#endif
- if ((dirp = CVS_OPENDIR (repository)) == NULL)
- error (1, 0, "cannot open directory %s", repository);
+ do {
+ if ((dirp = CVS_OPENDIR (repository)) == NULL)
+ error (1, 0, "cannot open directory %s", repository);
- errno = 0;
- while ((dp = CVS_READDIR (dirp)) != NULL)
- {
- if (CVS_FNMATCH (CVSRFLPAT, dp->d_name, 0) == 0)
+ ret = 0;
+ errno = 0;
+ while ((dp = CVS_READDIR (dirp)) != NULL)
{
-#ifdef CVS_FUDGELOCKS
- time_t now;
- (void) time (&now);
-#endif
-
- line = xmalloc (strlen (repository) + strlen (dp->d_name) + 5);
- (void) sprintf (line, "%s/%s", repository, dp->d_name);
- if ( CVS_STAT (line, &sb) != -1)
+ if (CVS_FNMATCH (CVSRFLPAT, dp->d_name, 0) == 0)
{
+ /* ignore our own readlock, if any */
+ if (readlock && strcmp (readlock, dp->d_name) == 0)
+ continue;
+
+ line = xmalloc (strlen (repository) + strlen (dp->d_name) + 5);
+ (void) sprintf (line, "%s/%s", repository, dp->d_name);
+ if ( CVS_STAT (line, &sb) != -1)
+ {
#ifdef CVS_FUDGELOCKS
- /*
- * If the create time of the file is more than CVSLCKAGE
- * seconds ago, try to clean-up the lock file, and if
- * successful, re-open the directory and try again.
- */
- if (now >= (sb.st_ctime + CVSLCKAGE) && CVS_UNLINK (line) != -1)
+ /*
+ * If the create time of the file is more than CVSLCKAGE
+ * seconds ago, try to clean-up the lock file, and if
+ * successful, re-open the directory and try again.
+ */
+ if (now >= (sb.st_ctime + CVSLCKAGE) &&
+ CVS_UNLINK (line) != -1)
+ {
+ free (line);
+ ret = -1;
+ break;
+ }
+#endif
+ set_lockers_name (&sb);
+ }
+ else
{
- (void) CVS_CLOSEDIR (dirp);
- free (line);
- goto again;
+ /* If the file doesn't exist, it just means that it disappeared
+ between the time we did the readdir and the time we did
+ the stat. */
+ if (!existence_error (errno))
+ error (0, errno, "cannot stat %s", line);
}
-#endif
- set_lockers_name (&sb);
- }
- else
- {
- /* If the file doesn't exist, it just means that it disappeared
- between the time we did the readdir and the time we did
- the stat. */
- if (!existence_error (errno))
- error (0, errno, "cannot stat %s", line);
+ errno = 0;
+ free (line);
+ ret = 1;
+ break;
}
errno = 0;
- free (line);
-
- ret = 1;
- break;
}
- errno = 0;
- }
- if (errno != 0)
- error (0, errno, "error reading directory %s", repository);
+ if (errno != 0)
+ error (0, errno, "error reading directory %s", repository);
- CVS_CLOSEDIR (dirp);
+ CVS_CLOSEDIR (dirp);
+ } while (ret < 0);
return (ret);
}
@@ -844,10 +846,13 @@ lock_wait (repos)
{
time_t now;
char *msg;
+ struct tm *tm_p;
(void) time (&now);
+ tm_p = gmtime (&now);
msg = xmalloc (100 + strlen (lockers_name) + strlen (repos));
- sprintf (msg, "[%8.8s] waiting for %s's lock in %s", ctime (&now) + 11,
+ sprintf (msg, "[%8.8s] waiting for %s's lock in %s",
+ (tm_p ? asctime (tm_p) : ctime (&now)) + 11,
lockers_name, repos);
error (0, 0, "%s", msg);
/* Call cvs_flusherr to ensure that the user sees this message as
@@ -866,10 +871,13 @@ lock_obtained (repos)
{
time_t now;
char *msg;
+ struct tm *tm_p;
(void) time (&now);
+ tm_p = gmtime (&now);
msg = xmalloc (100 + strlen (repos));
- sprintf (msg, "[%8.8s] obtained lock in %s", ctime (&now) + 11, repos);
+ sprintf (msg, "[%8.8s] obtained lock in %s",
+ (tm_p ? asctime (tm_p) : ctime (&now)) + 11, repos);
error (0, 0, "%s", msg);
/* Call cvs_flusherr to ensure that the user sees this message as
soon as possible. */
@@ -924,7 +932,8 @@ lock_tree_for_write (argc, argv, local, which, aflag)
lock_tree_list = getlist ();
err = start_recursion ((FILEPROC) NULL, lock_filesdoneproc,
(DIRENTPROC) NULL, (DIRLEAVEPROC) NULL, NULL, argc,
- argv, local, which, aflag, 0, (char *) NULL, 0);
+ argv, local, which, aflag, LOCK_NONE,
+ (char *) NULL, 0);
sortlist (lock_tree_list, fsortcmp);
if (Writer_Lock (lock_tree_list) != 0)
error (1, 0, "lock failed - giving up");
diff --git a/contrib/cvs/src/login.c b/contrib/cvs/src/login.c
index a90212f..58b2c7a 100644
--- a/contrib/cvs/src/login.c
+++ b/contrib/cvs/src/login.c
@@ -67,17 +67,7 @@ construct_cvspass_filename ()
return (char *) NULL;
}
- passfile =
- (char *) xmalloc (strlen (homedir) + strlen (CVS_PASSWORD_FILE) + 3);
- strcpy (passfile, homedir);
-#ifndef NO_SLASH_AFTER_HOME
- /* NO_SLASH_AFTER_HOME is defined for VMS, where foo:[bar]/.cvspass is not
- a legal filename but foo:[bar].cvspass is. A more clean solution would
- be something more along the lines of a "join a directory to a filename"
- kind of thing.... */
- strcat (passfile, "/");
-#endif
- strcat (passfile, CVS_PASSWORD_FILE);
+ passfile = strcat_filename_onto_homedir (homedir, CVS_PASSWORD_FILE);
/* Safety first and last, Scouts. */
if (isfile (passfile))
@@ -315,6 +305,8 @@ password_entry_operation (operation, root, newpassword)
error (1, 0, "CVSROOT: %s", root->original);
}
+ cvsroot_canonical = normalize_cvsroot (root);
+
/* Yes, the method below reads the user's password file twice when we have
* to delete an entry. It's inefficient, but we're not talking about a gig of
* data here.
@@ -328,8 +320,6 @@ password_entry_operation (operation, root, newpassword)
goto process;
}
- cvsroot_canonical = normalize_cvsroot (root);
-
/* Check each line to see if we have this entry already. */
line = 0;
while ((line_length = getline (&linebuf, &linebuf_len, fp)) >= 0)
diff --git a/contrib/cvs/src/logmsg.c b/contrib/cvs/src/logmsg.c
index d67410d..e333663 100644
--- a/contrib/cvs/src/logmsg.c
+++ b/contrib/cvs/src/logmsg.c
@@ -136,7 +136,7 @@ fmt_proc (p, closure)
{
if (col > 0)
(void) fprintf (fp, "\n");
- (void) fprintf (fp, "%s", prefix);
+ (void) fputs (prefix, fp);
col = strlen (prefix);
while (col < 6)
{
@@ -197,8 +197,11 @@ do_editor (dir, messagep, repository, changes)
struct stat pre_stbuf, post_stbuf;
int retcode = 0;
- assert (current_parsed_root->isremote && !repository
- || !current_parsed_root->isremote && repository);
+#ifdef CLIENT_SUPPORT
+ assert (!current_parsed_root->isremote != !repository);
+#else
+ assert (repository);
+#endif
if (noexec || reuse_log_message)
return;
@@ -218,7 +221,7 @@ do_editor (dir, messagep, repository, changes)
if (*messagep)
{
- (void) fprintf (fp, "%s", *messagep);
+ (void) fputs (*messagep, fp);
if ((*messagep)[0] == '\0' ||
(*messagep)[strlen (*messagep) - 1] != '\n')
@@ -355,16 +358,16 @@ do_editor (dir, messagep, repository, changes)
if (fclose (fp) < 0)
error (0, errno, "warning: cannot close %s", fname);
- if (pre_stbuf.st_mtime == post_stbuf.st_mtime ||
- *messagep == NULL ||
- (*messagep)[0] == '\0' ||
- strcmp (*messagep, "\n") == 0)
+ /* canonicalize emply messages */
+ if (*messagep != NULL &&
+ (**messagep == '\0' || strcmp (*messagep, "\n") == 0))
+ {
+ free (*messagep);
+ *messagep = NULL;
+ }
+
+ if (pre_stbuf.st_mtime == post_stbuf.st_mtime || *messagep == NULL)
{
- if (*messagep)
- {
- free (*messagep);
- *messagep = NULL;
- }
for (;;)
{
(void) printf ("\nLog message unchanged or not specified\n");
@@ -433,13 +436,13 @@ do_verify (messagep, repository)
if (noexec)
return;
- /* If there's no message, then we have nothing to verify. Can this
- case happen? And if so why would we print a message? */
- if (*messagep == NULL)
- {
- cvs_output ("No message to verify\n", 0);
+ /* Get the name of the verification script to run */
+
+ if (repository != NULL)
+ (void) Parse_Info (CVSROOTADM_VERIFYMSG, repository,
+ verifymsg_proc, 0);
+ if (!verifymsg_script)
return;
- }
/* open a temporary file, write the message to the
temp file, and close the file. */
@@ -447,10 +450,12 @@ do_verify (messagep, repository)
if ((fp = cvs_temp_file (&fname)) == NULL)
error (1, errno, "cannot create temporary file %s", fname);
- fprintf (fp, "%s", *messagep);
- if ((*messagep)[0] == '\0' ||
+ if (*messagep != NULL)
+ fputs (*messagep, fp);
+ if (*messagep == NULL ||
+ (*messagep)[0] == '\0' ||
(*messagep)[strlen (*messagep) - 1] != '\n')
- (void) fprintf (fp, "%s", "\n");
+ putc ('\n', fp);
if (fclose (fp) == EOF)
error (1, errno, "%s", fname);
@@ -467,28 +472,17 @@ do_verify (messagep, repository)
sleep_past (pre_stbuf.st_mtime);
}
- /* Get the name of the verification script to run */
-
- if (repository != NULL)
- (void) Parse_Info (CVSROOTADM_VERIFYMSG, repository,
- verifymsg_proc, 0);
-
- /* Run the verification script */
-
- if (verifymsg_script)
+ run_setup (verifymsg_script);
+ run_arg (fname);
+ if ((retcode = run_exec (RUN_TTY, RUN_TTY, RUN_TTY,
+ RUN_NORMAL | RUN_SIGIGNORE)) != 0)
{
- run_setup (verifymsg_script);
- run_arg (fname);
- if ((retcode = run_exec (RUN_TTY, RUN_TTY, RUN_TTY,
- RUN_NORMAL | RUN_SIGIGNORE)) != 0)
- {
- /* Since following error() exits, delete the temp file now. */
- if (unlink_file (fname) < 0)
- error (0, errno, "cannot remove %s", fname);
+ /* Since following error() exits, delete the temp file now. */
+ if (unlink_file (fname) < 0)
+ error (0, errno, "cannot remove %s", fname);
- error (1, retcode == -1 ? errno : 0,
- "Message verification failed");
- }
+ error (1, retcode == -1 ? errno : 0,
+ "Message verification failed");
}
/* Get the mod time and size of the possibly new log message
@@ -510,8 +504,6 @@ do_verify (messagep, repository)
pre_stbuf.st_size != post_stbuf.st_size)))
{
/* put the entire message back into the *messagep variable */
- if ( (fp = open_file (fname, "r")) == NULL )
- error (1, errno, "cannot open temporary file %s", fname);
if (*messagep) free (*messagep);
@@ -519,18 +511,18 @@ do_verify (messagep, repository)
*messagep = NULL;
else
{
- /* On NT, we might read less than st_size bytes,
- but we won't read more. So this works. */
- *messagep = (char *) xmalloc (post_stbuf.st_size + 1);
- *messagep[0] = '\0';
- }
-
- if (*messagep)
- {
char *line = NULL;
int line_length;
size_t line_chars_allocated = 0;
- char *p = *messagep;
+ char *p;
+
+ if ( (fp = open_file (fname, "r")) == NULL )
+ error (1, errno, "cannot open temporary file %s", fname);
+
+ /* On NT, we might read less than st_size bytes,
+ but we won't read more. So this works. */
+ p = *messagep = (char *) xmalloc (post_stbuf.st_size + 1);
+ *messagep[0] = '\0';
while (1)
{
@@ -552,9 +544,9 @@ do_verify (messagep, repository)
p += line_length;
}
if (line) free (line);
+ if (fclose (fp) < 0)
+ error (0, errno, "warning: cannot close %s", fname);
}
- if (fclose (fp) < 0)
- error (0, errno, "warning: cannot close %s", fname);
}
/* Delete the temp file */
@@ -716,6 +708,11 @@ title_proc (p, closure)
fields). This way if future CVS versions add formatting
characters, one can write a loginfo file which at least
won't blow up on an old CVS. */
+ /* Note that people who have to deal with spaces in file
+ and directory names are using space to get a known
+ delimiter for the directory name, so it's probably
+ not a good idea to ever define that as a formatting
+ character. */
}
if (*(c + 1) != '\0')
{
diff --git a/contrib/cvs/src/main.c b/contrib/cvs/src/main.c
index 5c9596d..405fa59 100644
--- a/contrib/cvs/src/main.c
+++ b/contrib/cvs/src/main.c
@@ -568,7 +568,7 @@ main (argc, argv)
version (0, (char **) NULL);
(void) fputs ("\n", stdout);
(void) fputs ("\
-Copyright (c) 1989-2001 Brian Berliner, david d `zoo' zuhn, \n\
+Copyright (c) 1989-2002 Brian Berliner, david d `zoo' zuhn, \n\
Jeff Polk, and other authors\n", stdout);
(void) fputs ("\n", stdout);
(void) fputs ("CVS may be copied only under the terms of the GNU General Public License,\n", stdout);
@@ -706,7 +706,9 @@ Copyright (c) 1989-2001 Brian Berliner, david d `zoo' zuhn, \n\
CVSUMASK_ENV, cp);
}
-#if defined (HAVE_KERBEROS) && defined (SERVER_SUPPORT)
+#ifdef SERVER_SUPPORT
+
+# ifdef HAVE_KERBEROS
/* If we are invoked with a single argument "kserver", then we are
running as Kerberos server as root. Do the authentication as
the very first thing, to minimize the amount of time we are
@@ -718,10 +720,10 @@ Copyright (c) 1989-2001 Brian Berliner, david d `zoo' zuhn, \n\
/* Pretend we were invoked as a plain server. */
command_name = "server";
}
-#endif /* HAVE_KERBEROS */
+# endif /* HAVE_KERBEROS */
-#if (defined(AUTH_SERVER_SUPPORT) || defined (HAVE_GSSAPI)) && defined(SERVER_SUPPORT)
+# if defined (AUTH_SERVER_SUPPORT) || defined (HAVE_GSSAPI)
if (strcmp (command_name, "pserver") == 0)
{
/* The reason that --allow-root is not a command option
@@ -738,11 +740,11 @@ Copyright (c) 1989-2001 Brian Berliner, david d `zoo' zuhn, \n\
/* Pretend we were invoked as a plain server. */
command_name = "server";
}
-#endif /* (AUTH_SERVER_SUPPORT || HAVE_GSSAPI) && SERVER_SUPPORT */
+# endif /* AUTH_SERVER_SUPPORT || HAVE_GSSAPI */
-#ifdef SERVER_SUPPORT
server_active = strcmp (command_name, "server") == 0;
-#endif
+
+#endif /* SERVER_SUPPORT */
/* This is only used for writing into the history file. For
remote connections, it might be nice to have hostname
@@ -1044,7 +1046,10 @@ Copyright (c) 1989-2001 Brian Berliner, david d `zoo' zuhn, \n\
#ifdef SERVER_SUPPORT
if (server_active)
- break;
+ {
+ server_active = 0;
+ break;
+ }
#endif
} /* end of loop for cvsroot values */
diff --git a/contrib/cvs/src/options.h.in b/contrib/cvs/src/options.h.in
deleted file mode 100644
index a3ee047..0000000
--- a/contrib/cvs/src/options.h.in
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (c) 1992, Brian Berliner and Jeff Polk
- * Copyright (c) 1989-1992, Brian Berliner
- *
- * You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS source distribution.
- *
- * This file holds (most of) the configuration tweaks that can be made to
- * customize CVS for your site. CVS comes configured for a typical SunOS 4.x
- * environment. The comments for each configurable item are intended to be
- * self-explanatory. All #defines are tested first to see if an over-riding
- * option was specified on the "make" command line.
- *
- * If special libraries are needed, you will have to edit the Makefile.in file
- * or the configure script directly. Sorry.
- */
-
-/* By default, CVS stores its modules and other such items in flat
- text files (MY_NDBM enables this). Turning off MY_NDBM causes CVS
- to look for a system-supplied ndbm database library and use it
- instead. That may speed things up, but the default setting
- generally works fine too. */
-
-#ifndef MY_NDBM
-#define MY_NDBM
-#endif
-
-/*
- * The "patch" program to run when using the CVS server and accepting
- * patches across the network. Specify a full pathname if your site
- * wants to use a particular patch.
- */
-#ifndef PATCH_PROGRAM
-#define PATCH_PROGRAM "patch"
-#endif
-
-/* Directory used for storing temporary files, if not overridden by
- environment variables or the -T global option. There should be little
- need to change this (-T is a better mechanism if you need to use a
- different directory for temporary files). */
-#ifndef TMPDIR_DFLT
-#define TMPDIR_DFLT "/tmp"
-#endif
-
-/*
- * The default editor to use, if one does not specify the "-e" option
- * to cvs, or does not have an EDITOR environment variable. I set
- * this to just "vi", and use the shell to find where "vi" actually
- * is. This allows sites with /usr/bin/vi or /usr/ucb/vi to work
- * equally well (assuming that your PATH is reasonable).
- */
-#ifndef EDITOR_DFLT
-#define EDITOR_DFLT "vi"
-#endif
-
-/*
- * The default umask to use when creating or otherwise setting file or
- * directory permissions in the repository. Must be a value in the
- * range of 0 through 0777. For example, a value of 002 allows group
- * rwx access and world rx access; a value of 007 allows group rwx
- * access but no world access. This value is overridden by the value
- * of the CVSUMASK environment variable, which is interpreted as an
- * octal number.
- */
-#ifndef UMASK_DFLT
-#define UMASK_DFLT 002
-#endif
-
-/*
- * The cvs admin command is restricted to the members of the group
- * CVS_ADMIN_GROUP. If this group does not exist, all users are
- * allowed to run cvs admin. To disable the cvs admin for all users,
- * create an empty group CVS_ADMIN_GROUP. To disable access control
- * for cvs admin, comment out the define below.
- */
-#ifndef CVS_ADMIN_GROUP
-#define CVS_ADMIN_GROUP "cvsadmin"
-#endif
-
-/*
- * The Repository file holds the path to the directory within the
- * source repository that contains the RCS ,v files for each CVS
- * working directory. This path is either a full-path or a path
- * relative to CVSROOT.
- *
- * The big advantage that I can see to having a relative path is that
- * one can change the physical location of the master source
- * repository, change the contents of CVS/Root files in your
- * checked-out code, and CVS will work without problems.
- *
- * Therefore, RELATIVE_REPOS is now the default. In the future, this
- * is likely to disappear entirely as a compile-time (or other) option,
- * so if you have other software which relies on absolute pathnames,
- * update them.
- */
-#define RELATIVE_REPOS 1
-
-/*
- * When committing or importing files, you must enter a log message.
- * Normally, you can do this either via the -m flag on the command
- * line or an editor will be started for you. If you like to use
- * logging templates (the rcsinfo file within the $CVSROOT/CVSROOT
- * directory), you might want to force people to use the editor even
- * if they specify a message with -m. Enabling FORCE_USE_EDITOR will
- * cause the -m message to be appended to the temp file when the
- * editor is started.
- */
-#ifndef FORCE_USE_EDITOR
-/* #define FORCE_USE_EDITOR */
-#endif
-
-/*
- * When locking the repository, some sites like to remove locks and
- * assume the program that created them went away if the lock has
- * existed for a long time. This used to be the default for previous
- * versions of CVS. CVS now attempts to be much more robust, so lock
- * files should not be left around by mistake. The new behaviour will
- * never remove old locks (they must now be removed by hand).
- * Enabling CVS_FUDGELOCKS will cause CVS to remove locks that are
- * older than CVSLCKAGE seconds.
- *
- * Use of this option is NOT recommended.
- */
-#ifndef CVS_FUDGELOCKS
-/* #define CVS_FUDGELOCKS */
-#endif
-
-/*
- * When committing a permanent change, CVS and RCS make a log entry of
- * who committed the change. If you are committing the change logged
- * in as "root" (not under "su" or other root-priv giving program),
- * CVS/RCS cannot determine who is actually making the change.
- *
- * As such, by default, CVS disallows changes to be committed by users
- * logged in as "root". You can disable this option by commenting out
- * the lines below.
- */
-#ifndef CVS_BADROOT
-#define CVS_BADROOT
-#endif
-
-/* Define this to enable the SETXID support. The way to use this is
- to create a group with no users in it (except perhaps cvs
- administrators), set the cvs executable to setgid that group, chown
- all the repository files to that group, and change all directory
- permissions in the repository to 770. The last person to modify a
- file will own it, but as long as directory permissions are set
- right that won't matter. You'll need a system which inherits file
- groups from the parent directory (WARNING: using the wrong kind of
- system (I think Solaris 2.4 is the wrong kind, for example) will
- create a security hole! You will receive no warning other than the
- fact that files in the working directory are owned by the group
- which cvs is setgid to).
-
- One security hole which has been reported is that setgid is not
- turned off when the editor is invoked--most editors provide a way
- to execute a shell, or the user can specify an editor (this one is
- large enough to drive a truck through). Don't assume that the
- holes described here are the only ones; I don't know how carefully
- SETXID has been inspected for security holes. */
-#ifndef SETXID_SUPPORT
-/* #define SETXID_SUPPORT */
-#endif
-
-/*
- * Should we build the password-authenticating client? Whether to
- * include the password-authenticating _server_, on the other hand, is
- * set in config.h.
- */
-#ifdef CLIENT_SUPPORT
-#define AUTH_CLIENT_SUPPORT 1
-#endif
-
-/*
- * If you are working with a large remote repository and a 'cvs
- * checkout' is swamping your network and memory, define these to
- * enable flow control. You will end up with even less probability of
- * a consistent checkout (see Concurrency in cvs.texinfo), but CVS
- * doesn't try to guarantee that anyway. The master server process
- * will monitor how far it is getting behind, if it reaches the high
- * water mark, it will signal the child process to stop generating
- * data when convenient (ie: no locks are held, currently at the
- * beginning of a new directory). Once the buffer has drained
- * sufficiently to reach the low water mark, it will be signalled to
- * start again. You may override the default hi/low watermarks here
- * too.
- */
-#define SERVER_FLOWCONTROL
-#define SERVER_HI_WATER (2 * 1024 * 1024)
-#define SERVER_LO_WATER (1 * 1024 * 1024)
-
-/* End of CVS configuration section */
-
-/*
- * Externs that are included in libc, but are used frequently enough
- * to warrant defining here.
- */
-#ifndef STDC_HEADERS
-extern void exit ();
-#endif
diff --git a/contrib/cvs/src/rcs.c b/contrib/cvs/src/rcs.c
index faa6ee7..205ff4d 100644
--- a/contrib/cvs/src/rcs.c
+++ b/contrib/cvs/src/rcs.c
@@ -21,6 +21,9 @@
# ifndef HAVE_GETPAGESIZE
# include "getpagesize.h"
# endif
+# ifndef MAP_FAILED
+# define MAP_FAILED NULL
+# endif
#endif
int preserve_perms = 0;
@@ -1096,7 +1099,8 @@ rcsbuf_getkey (rcsbuf, keyp, valp)
ptrend = rcsbuf->ptrend;
/* Sanity check. */
- assert (ptr >= rcsbuf_buffer && ptr < rcsbuf_buffer + rcsbuf_buffer_size);
+ assert (ptr >= rcsbuf_buffer && ptr <= rcsbuf_buffer + rcsbuf_buffer_size);
+ assert (ptrend >= rcsbuf_buffer && ptrend <= rcsbuf_buffer + rcsbuf_buffer_size);
#ifndef HAVE_MMAP
/* If the pointer is more than RCSBUF_BUFSIZE bytes into the
@@ -1590,10 +1594,6 @@ rcsbuf_fill (rcsbuf, ptr, keyp, valp)
poff = ptr - rcsbuf_buffer;
peoff = rcsbuf->ptrend - rcsbuf_buffer;
- if (keyp != NULL && *keyp != NULL)
- koff = *keyp - rcsbuf_buffer;
- if (valp != NULL && *valp != NULL)
- voff = *valp - rcsbuf_buffer;
koff = keyp == NULL ? 0 : *keyp - rcsbuf_buffer;
voff = valp == NULL ? 0 : *valp - rcsbuf_buffer;
@@ -1602,9 +1602,9 @@ rcsbuf_fill (rcsbuf, ptr, keyp, valp)
ptr = rcsbuf_buffer + poff;
rcsbuf->ptrend = rcsbuf_buffer + peoff;
- if (keyp != NULL && *keyp != NULL)
+ if (keyp != NULL)
*keyp = rcsbuf_buffer + koff;
- if (valp != NULL && *valp != NULL)
+ if (valp != NULL)
*valp = rcsbuf_buffer + voff;
}
@@ -5045,7 +5045,7 @@ RCS_checkin (rcs, workfile, message, rev, flags)
delta->other_delta = getlist();
if (CVS_LSTAT (workfile, &sb) < 0)
- error (1, 1, "cannot lstat %s", workfile);
+ error (1, errno, "cannot lstat %s", workfile);
if (S_ISLNK (sb.st_mode))
{
@@ -5084,7 +5084,7 @@ RCS_checkin (rcs, workfile, message, rev, flags)
case S_IFREG: break;
case S_IFCHR:
case S_IFBLK:
-# ifdef HAVE_ST_RDEV
+# ifdef HAVE_STRUCT_STAT_ST_RDEV
np = getnode();
np->type = RCSFIELD;
np->key = xstrdup ("special");
@@ -8416,13 +8416,12 @@ rcs_internal_unlockfile (fp, rcsfile)
corrupting the repository. */
if (ferror (fp))
- /* The only case in which using errno here would be meaningful
- is if we happen to have left errno unmolested since the call
- which produced the error (e.g. fprintf). That is pretty
- fragile even if it happens to sometimes be true. The real
- solution is to check each call to fprintf rather than waiting
+ /* Using errno here may well be misleanding since the most recent
+ call that set errno may not have anything whatsoever to do with
+ the error that set the flag, but it's better than nothing. The
+ real solution is to check each call to fprintf rather than waiting
until the end like this. */
- error (1, 0, "error writing to lock file %s", rcs_lockfile);
+ error (1, errno, "error writing to lock file %s", rcs_lockfile);
if (fclose (fp) == EOF)
error (1, errno, "error closing lock file %s", rcs_lockfile);
rcs_lockfd = -1;
diff --git a/contrib/cvs/src/rcscmds.c b/contrib/cvs/src/rcscmds.c
index b233b76..2ce586b 100644
--- a/contrib/cvs/src/rcscmds.c
+++ b/contrib/cvs/src/rcscmds.c
@@ -454,7 +454,7 @@ RCS file: ", 0);
}
RCS_output_diff_options (opts, rev1, rev2, workfile);
- status = diff_execv (tmpfile1, use_file2, label1, label2, opts, RUN_TTY);
+ status = diff_exec (tmpfile1, use_file2, label1, label2, opts, RUN_TTY);
if (status >= 0)
{
retval = status;
@@ -583,55 +583,7 @@ diff_exec (file1, file2, label1, label2, options, out)
call_diff_arg (label1);
if (label2)
call_diff_arg (label2);
- call_diff_arg (file1);
- call_diff_arg (file2);
- free (args);
-
- return call_diff (out);
-}
-
-int
-diff_execv (file1, file2, label1, label2, options, out)
- char *file1;
- char *file2;
- char *label1;
- char *label2;
- char *options;
- char *out;
-{
- char *args;
-
-#ifdef PRESERVE_PERMISSIONS_SUPPORT
- /* Pretend that special files are /dev/null for purposes of making
- diffs. See comments in diff_exec. */
-
- if (preserve_perms &&
- strcmp (file1, DEVNULL) != 0 &&
- strcmp (file2, DEVNULL) != 0)
- {
- struct stat sb1, sb2;
-
- if (CVS_LSTAT (file1, &sb1) < 0)
- error (1, errno, "cannot get file information for %s", file1);
- if (CVS_LSTAT (file2, &sb2) < 0)
- error (1, errno, "cannot get file information for %s", file2);
-
- if (!S_ISREG (sb1.st_mode) && !S_ISDIR (sb1.st_mode))
- file1 = DEVNULL;
- if (!S_ISREG (sb2.st_mode) && !S_ISDIR (sb2.st_mode))
- file2 = DEVNULL;
- }
-#endif
-
- args = xmalloc (strlen (options) + 10);
- /* The first word in this string is used only for error reporting. */
- /* I guess we are pretty confident that options starts with a space. */
- sprintf (args, "diff%s", options);
- call_diff_setup (args);
- if (label1)
- call_diff_arg (label1);
- if (label2)
- call_diff_arg (label2);
+ call_diff_arg ("--");
call_diff_arg (file1);
call_diff_arg (file2);
free (args);
diff --git a/contrib/cvs/src/recurse.c b/contrib/cvs/src/recurse.c
index e07869c..1da1abd 100644
--- a/contrib/cvs/src/recurse.c
+++ b/contrib/cvs/src/recurse.c
@@ -34,7 +34,7 @@ struct recursion_frame {
Dtype flags;
int which;
int aflag;
- int readlock;
+ int locktype;
int dosrcs;
};
@@ -67,7 +67,7 @@ struct frame_and_entries {
default to ".". */
int
start_recursion (fileproc, filesdoneproc, direntproc, dirleaveproc, callerdat,
- argc, argv, local, which, aflag, readlock,
+ argc, argv, local, which, aflag, locktype,
update_preload, dosrcs)
FILEPROC fileproc;
FILESDONEPROC filesdoneproc;
@@ -103,7 +103,7 @@ start_recursion (fileproc, filesdoneproc, direntproc, dirleaveproc, callerdat,
int which;
int aflag;
- int readlock;
+ int locktype;
char *update_preload;
int dosrcs;
{
@@ -122,7 +122,7 @@ start_recursion (fileproc, filesdoneproc, direntproc, dirleaveproc, callerdat,
frame.flags = local ? R_SKIP_DIRS : R_PROCESS;
frame.which = which;
frame.aflag = aflag;
- frame.readlock = readlock;
+ frame.locktype = locktype;
frame.dosrcs = dosrcs;
expand_wild (argc, argv, &argc, &argv);
@@ -505,14 +505,14 @@ do_recursion (frame)
int dodoneproc = 1;
char *srepository;
List *entries = NULL;
- int should_readlock;
+ int locktype;
int process_this_directory = 1;
/* do nothing if told */
if (frame->flags == R_SKIP_ALL)
return (0);
- should_readlock = noexec ? 0 : frame->readlock;
+ locktype = noexec ? LOCK_NONE : frame->locktype;
/* The fact that locks are not active here is what makes us fail to have
the
@@ -550,11 +550,9 @@ do_recursion (frame)
/*
* Now would be a good time to check to see if we need to stop
* generating data, to give the buffers a chance to drain to the
- * remote client. We should not have locks active at this point.
- */
- if (server_active
- /* If there are writelocks around, we cannot pause here. */
- && (should_readlock || noexec))
+ * remote client. We should not have locks active at this point,
+ * but if there are writelocks around, we cannot pause here. */
+ if (server_active && locktype != LOCK_NONE)
server_pause_check();
#endif
@@ -707,8 +705,16 @@ do_recursion (frame)
struct frame_and_file frfile;
/* read lock it if necessary */
- if (should_readlock && repository && Reader_Lock (repository) != 0)
- error (1, 0, "read lock failed - giving up");
+ if (repository)
+ {
+ if (locktype == LOCK_READ)
+ {
+ if (Reader_Lock (repository) != 0)
+ error (1, 0, "read lock failed - giving up");
+ }
+ else if (locktype == LOCK_WRITE)
+ lock_dir_for_write (repository);
+ }
#ifdef CLIENT_SUPPORT
/* For the server, we handle notifications in a completely different
@@ -731,7 +737,7 @@ do_recursion (frame)
err += walklist (filelist, do_file_proc, &frfile);
/* unlock it */
- if (should_readlock)
+ if (locktype != LOCK_NONE)
Lock_Cleanup ();
/* clean up */
diff --git a/contrib/cvs/src/server.c b/contrib/cvs/src/server.c
index 00852e9..c9034d5 100644
--- a/contrib/cvs/src/server.c
+++ b/contrib/cvs/src/server.c
@@ -714,17 +714,7 @@ serve_valid_responses (arg)
cause deadlock, as noted in server_cleanup. */
buf_flush (buf_to_net, 1);
- /* I'm doing this manually rather than via error_exit ()
- because I'm not sure whether we want to call server_cleanup.
- Needs more investigation.... */
-
-#ifdef SYSTEM_CLEANUP
- /* Hook for OS-specific behavior, for example socket subsystems on
- NT and OS2 or dealing with windows and arguments on Mac. */
- SYSTEM_CLEANUP ();
-#endif
-
- exit (EXIT_FAILURE);
+ error_exit ();
}
else if (rs->status == rs_optional)
rs->status = rs_not_supported;
@@ -869,7 +859,10 @@ outside_root (repos)
/* I think isabsolute (repos) should always be true, and that
any RELATIVE_REPOS stuff should only be in CVS/Repository
files, not the protocol (for compatibility), but I'm putting
- in the isabsolute check just in case. */
+ in the isabsolute check just in case.
+
+ This is a good security precaution regardless. -DRP
+ */
if (!isabsolute (repos))
{
if (alloc_pending (repos_len + 80))
@@ -2922,10 +2915,10 @@ error \n");
fd_set readfds;
fd_set writefds;
int numfds;
-#ifdef SERVER_FLOWCONTROL
- int bufmemsize;
struct timeval *timeout_ptr;
struct timeval timeout;
+#ifdef SERVER_FLOWCONTROL
+ int bufmemsize;
/*
* See if we are swamping the remote client and filling our VM.
@@ -3217,10 +3210,13 @@ E CVS locks may need cleaning up.\n");
buf_flush (buf_to_net, 1);
buf_shutdown (protocol_inbuf);
buf_free (protocol_inbuf);
+ protocol_inbuf = NULL;
buf_shutdown (stderrbuf);
buf_free (stderrbuf);
+ stderrbuf = NULL;
buf_shutdown (stdoutbuf);
buf_free (stdoutbuf);
+ stdoutbuf = NULL;
}
if (errs)
@@ -3719,7 +3715,7 @@ static void
serve_watch_on (arg)
char *arg;
{
- do_cvs_command ("watch_on", watch_on);
+ do_cvs_command ("watch", watch_on);
}
static void serve_watch_off PROTO ((char *));
@@ -3728,7 +3724,7 @@ static void
serve_watch_off (arg)
char *arg;
{
- do_cvs_command ("watch_off", watch_off);
+ do_cvs_command ("watch", watch_off);
}
static void serve_watch_add PROTO ((char *));
@@ -3737,7 +3733,7 @@ static void
serve_watch_add (arg)
char *arg;
{
- do_cvs_command ("watch_add", watch_add);
+ do_cvs_command ("watch", watch_add);
}
static void serve_watch_remove PROTO ((char *));
@@ -3746,7 +3742,7 @@ static void
serve_watch_remove (arg)
char *arg;
{
- do_cvs_command ("watch_remove", watch_remove);
+ do_cvs_command ("watch", watch_remove);
}
static void serve_watchers PROTO ((char *));
@@ -4895,9 +4891,9 @@ server_cleanup (sig)
status = buf_shutdown (buf_from_net);
if (status != 0)
- {
error (0, status, "shutting down buffer from client");
- }
+ buf_free (buf_from_net);
+ buf_from_net = NULL;
}
if (dont_delete_temp)
@@ -4906,6 +4902,9 @@ server_cleanup (sig)
{
(void) buf_flush (buf_to_net, 1);
(void) buf_shutdown (buf_to_net);
+ buf_free (buf_to_net);
+ buf_to_net = NULL;
+ error_use_protocol = 0;
}
return;
}
@@ -5007,6 +5006,9 @@ server_cleanup (sig)
{
(void) buf_flush (buf_to_net, 1);
(void) buf_shutdown (buf_to_net);
+ buf_free (buf_to_net);
+ buf_to_net = NULL;
+ error_use_protocol = 0;
}
}
@@ -5017,6 +5019,8 @@ server (argc, argv)
int argc;
char **argv;
{
+ char *error_prog_name; /* Used in error messages */
+
if (argc == -1)
{
static const char *const msg[] =
@@ -5073,18 +5077,7 @@ server (argc, argv)
printf ("E Fatal server error, aborting.\n\
error ENOMEM Virtual memory exhausted.\n");
- /* I'm doing this manually rather than via error_exit ()
- because I'm not sure whether we want to call server_cleanup.
- Needs more investigation.... */
-
-#ifdef SYSTEM_CLEANUP
- /* Hook for OS-specific behavior, for example socket
- subsystems on NT and OS2 or dealing with windows
- and arguments on Mac. */
- SYSTEM_CLEANUP ();
-#endif
-
- exit (EXIT_FAILURE);
+ error_exit ();
}
strcpy (server_temp_dir, Tmpdir);
@@ -5148,63 +5141,23 @@ error ENOMEM Virtual memory exhausted.\n");
}
}
-#ifdef SIGABRT
- (void) SIG_register (SIGABRT, server_cleanup);
-#endif
-#ifdef SIGHUP
- (void) SIG_register (SIGHUP, server_cleanup);
-#endif
-#ifdef SIGINT
- (void) SIG_register (SIGINT, server_cleanup);
-#endif
-#ifdef SIGQUIT
- (void) SIG_register (SIGQUIT, server_cleanup);
-#endif
-#ifdef SIGPIPE
- (void) SIG_register (SIGPIPE, server_cleanup);
-#endif
-#ifdef SIGTERM
- (void) SIG_register (SIGTERM, server_cleanup);
-#endif
-
/* Now initialize our argument vector (for arguments from the client). */
/* Small for testing. */
argument_vector_size = 1;
argument_vector =
- (char **) malloc (argument_vector_size * sizeof (char *));
- if (argument_vector == NULL)
- {
- /*
- * Strictly speaking, we're not supposed to output anything
- * now. But we're about to exit(), give it a try.
- */
- printf ("E Fatal server error, aborting.\n\
-error ENOMEM Virtual memory exhausted.\n");
-
- /* I'm doing this manually rather than via error_exit ()
- because I'm not sure whether we want to call server_cleanup.
- Needs more investigation.... */
-
-#ifdef SYSTEM_CLEANUP
- /* Hook for OS-specific behavior, for example socket subsystems on
- NT and OS2 or dealing with windows and arguments on Mac. */
- SYSTEM_CLEANUP ();
-#endif
-
- exit (EXIT_FAILURE);
- }
-
+ (char **) xmalloc (argument_vector_size * sizeof (char *));
argument_count = 1;
/* This gets printed if the client supports an option which the
server doesn't, causing the server to print a usage message.
- FIXME: probably should be using program_name here.
FIXME: just a nit, I suppose, but the usage message the server
prints isn't literally true--it suggests "cvs server" followed
by options which are for a particular command. Might be nice to
say something like "client apparently supports an option not supported
by this server" or something like that instead of usage message. */
- argument_vector[0] = "cvs server";
+ error_prog_name = xmalloc( strlen(program_name) + 8 );
+ sprintf(error_prog_name, "%s server", program_name);
+ argument_vector[0] = error_prog_name;
while (1)
{
@@ -5277,6 +5230,7 @@ error ENOMEM Virtual memory exhausted.\n");
}
free (orig_cmd);
}
+ free(error_prog_name);
server_cleanup (0);
return 0;
}
@@ -5426,8 +5380,8 @@ check_repository_password (username, password, repository, host_user_ptr)
int found_it = 0;
int namelen;
- /* We don't use current_parsed_root->directory because it hasn't been set yet
- * -- our `repository' argument came from the authentication
+ /* We don't use current_parsed_root->directory because it hasn't been
+ * set yet -- our `repository' argument came from the authentication
* protocol, not the regular CVS protocol.
*/
@@ -5588,7 +5542,7 @@ check_password (username, password, repository)
{
/* No cvs password found, so try /etc/passwd. */
- const char *found_passwd = NULL;
+ char *found_passwd = NULL;
struct passwd *pw;
#ifdef HAVE_GETSPNAM
struct spwd *spw;
@@ -5610,19 +5564,24 @@ check_password (username, password, repository)
printf ("E Fatal error, aborting.\n\
error 0 %s: no such user\n", username);
- /* I'm doing this manually rather than via error_exit ()
- because I'm not sure whether we want to call server_cleanup.
- Needs more investigation.... */
-
-#ifdef SYSTEM_CLEANUP
- /* Hook for OS-specific behavior, for example socket subsystems on
- NT and OS2 or dealing with windows and arguments on Mac. */
- SYSTEM_CLEANUP ();
-#endif
-
- exit (EXIT_FAILURE);
+ error_exit ();
}
+ /* Allow for dain bramaged HPUX passwd aging
+ * - Basically, HPUX adds a comma and some data
+ * about whether the passwd has expired or not
+ * on the end of the passwd field.
+ * - This code replaces the ',' with '\0'.
+ *
+ * FIXME - our workaround is brain damaged too. I'm
+ * guessing that HPUX WANTED other systems to think the
+ * password was wrong so logins would fail if the
+ * system didn't handle expired passwds and the passwd
+ * might be expired. I think the way to go here
+ * is with PAM.
+ */
+ strtok (found_passwd, ",");
+
if (*found_passwd)
{
/* user exists and has a password */
@@ -5655,16 +5614,7 @@ error 0 %s: no such user\n", username);
outweighs this. */
printf ("error 0 no such user %s in CVSROOT/passwd\n", username);
- /* I'm doing this manually rather than via error_exit ()
- because I'm not sure whether we want to call server_cleanup.
- Needs more investigation.... */
-
-#ifdef SYSTEM_CLEANUP
- /* Hook for OS-specific behavior, for example socket subsystems on
- NT and OS2 or dealing with windows and arguments on Mac. */
- SYSTEM_CLEANUP ();
-#endif
- exit (EXIT_FAILURE);
+ error_exit ();
}
else
{
@@ -5921,12 +5871,8 @@ kserver_authenticate_connection ()
{
printf ("E Fatal error, aborting.\n\
error %s getpeername or getsockname failed\n", strerror (errno));
-#ifdef SYSTEM_CLEANUP
- /* Hook for OS-specific behavior, for example socket subsystems on
- NT and OS2 or dealing with windows and arguments on Mac. */
- SYSTEM_CLEANUP ();
-#endif
- exit (EXIT_FAILURE);
+
+ error_exit ();
}
#ifdef SO_KEEPALIVE
@@ -5952,12 +5898,8 @@ error %s getpeername or getsockname failed\n", strerror (errno));
{
printf ("E Fatal error, aborting.\n\
error 0 kerberos: %s\n", krb_get_err_text(status));
-#ifdef SYSTEM_CLEANUP
- /* Hook for OS-specific behavior, for example socket subsystems on
- NT and OS2 or dealing with windows and arguments on Mac. */
- SYSTEM_CLEANUP ();
-#endif
- exit (EXIT_FAILURE);
+
+ error_exit ();
}
memcpy (kblock, auth.session, sizeof (C_Block));
@@ -5968,12 +5910,8 @@ error 0 kerberos: %s\n", krb_get_err_text(status));
{
printf ("E Fatal error, aborting.\n\
error 0 kerberos: can't get local name: %s\n", krb_get_err_text(status));
-#ifdef SYSTEM_CLEANUP
- /* Hook for OS-specific behavior, for example socket subsystems on
- NT and OS2 or dealing with windows and arguments on Mac. */
- SYSTEM_CLEANUP ();
-#endif
- exit (EXIT_FAILURE);
+
+ error_exit ();
}
/* Switch to run as this user. */
@@ -6362,12 +6300,12 @@ cvs_output (str, len)
if (len == 0)
len = strlen (str);
#ifdef SERVER_SUPPORT
- if (error_use_protocol)
+ if (error_use_protocol && buf_to_net != NULL)
{
buf_output (saved_output, str, len);
buf_copy_lines (buf_to_net, saved_output, 'M');
}
- else if (server_active)
+ else if (server_active && protocol != NULL)
{
buf_output (saved_output, str, len);
buf_copy_lines (protocol, saved_output, 'M');
diff --git a/contrib/cvs/src/stamp-h2.in b/contrib/cvs/src/stamp-h2.in
deleted file mode 100644
index 9788f70..0000000
--- a/contrib/cvs/src/stamp-h2.in
+++ /dev/null
@@ -1 +0,0 @@
-timestamp
diff --git a/contrib/cvs/src/update.c b/contrib/cvs/src/update.c
index 12f02fa..3474c44 100644
--- a/contrib/cvs/src/update.c
+++ b/contrib/cvs/src/update.c
@@ -298,6 +298,8 @@ update (argc, argv)
if (supported_request ("update-patches"))
send_arg ("-u");
+ send_arg ("--");
+
if (update_build_dirs)
flags |= SEND_BUILD_DIRS;
@@ -325,6 +327,8 @@ update (argc, argv)
error (1, errno, "could not chdir to %s", toplevel_wd);
}
+ send_arg ("--");
+
for (i = 0; i < failed_patches_count; i++)
if (unlink_file (failed_patches[i]) < 0
&& !existence_error (errno))
@@ -496,7 +500,7 @@ do_update (argc, argv, xoptions, xtag, xdate, xforce, local, xbuild, xaflag,
follows it; someone should make sure that I did it right. */
err = start_recursion (get_linkinfo_proc, (FILESDONEPROC) NULL,
(DIRENTPROC) NULL, (DIRLEAVEPROC) NULL, NULL,
- argc, argv, local, which, aflag, 1,
+ argc, argv, local, which, aflag, LOCK_READ,
preload_update_dir, 1);
if (err)
return (err);
@@ -512,7 +516,7 @@ do_update (argc, argv, xoptions, xtag, xdate, xforce, local, xbuild, xaflag,
/* call the recursion processor */
err = start_recursion (update_fileproc, update_filesdone_proc,
update_dirent_proc, update_dirleave_proc, NULL,
- argc, argv, local, which, aflag, 1,
+ argc, argv, local, which, aflag, LOCK_READ,
preload_update_dir, 1);
#ifdef SERVER_SUPPORT
@@ -1791,46 +1795,60 @@ patch_file (finfo, vers_ts, docheckout, file_info, checksum)
{
fail = 1;
}
- else
- {
+ }
+
+ if (! fail)
+ {
+ struct stat file2_info;
+
+ /* Check to make sure the patch is really shorter */
+ if (CVS_STAT (file2, &file2_info) < 0)
+ error (1, errno, "could not stat %s", file2);
+ if (CVS_STAT (finfo->file, file_info) < 0)
+ error (1, errno, "could not stat %s", finfo->file);
+ if (file2_info.st_size <= file_info->st_size)
+ fail = 1;
+ }
+
+ if (! fail)
+ {
# define BINARY "Binary"
- char buf[sizeof BINARY];
- unsigned int c;
-
- /* Stat the original RCS file, and then adjust it the way
- that RCS_checkout would. FIXME: This is an abstraction
- violation. */
- if (CVS_STAT (vers_ts->srcfile->path, file_info) < 0)
- error (1, errno, "could not stat %s", vers_ts->srcfile->path);
- if (chmod (finfo->file,
- file_info->st_mode & ~(S_IWRITE | S_IWGRP | S_IWOTH))
- < 0)
- error (0, errno, "cannot change mode of file %s", finfo->file);
- if (cvswrite
- && !fileattr_get (finfo->file, "_watched"))
- xchmod (finfo->file, 1);
-
- /* Check the diff output to make sure patch will be handle it. */
- e = CVS_FOPEN (finfo->file, "r");
- if (e == NULL)
- error (1, errno, "could not open diff output file %s",
- finfo->fullname);
- c = fread (buf, 1, sizeof BINARY - 1, e);
- buf[c] = '\0';
- if (strcmp (buf, BINARY) == 0)
- {
- /* These are binary files. We could use diff -a, but
- patch can't handle that. */
- fail = 1;
- }
- fclose (e);
+ char buf[sizeof BINARY];
+ unsigned int c;
+
+ /* Check the diff output to make sure patch will be handle it. */
+ e = CVS_FOPEN (finfo->file, "r");
+ if (e == NULL)
+ error (1, errno, "could not open diff output file %s",
+ finfo->fullname);
+ c = fread (buf, 1, sizeof BINARY - 1, e);
+ buf[c] = '\0';
+ if (strcmp (buf, BINARY) == 0)
+ {
+ /* These are binary files. We could use diff -a, but
+ patch can't handle that. */
+ fail = 1;
}
+ fclose (e);
}
if (! fail)
{
Vers_TS *xvers_ts;
+ /* Stat the original RCS file, and then adjust it the way
+ that RCS_checkout would. FIXME: This is an abstraction
+ violation. */
+ if (CVS_STAT (vers_ts->srcfile->path, file_info) < 0)
+ error (1, errno, "could not stat %s", vers_ts->srcfile->path);
+ if (chmod (finfo->file,
+ file_info->st_mode & ~(S_IWRITE | S_IWGRP | S_IWOTH))
+ < 0)
+ error (0, errno, "cannot change mode of file %s", finfo->file);
+ if (cvswrite
+ && !fileattr_get (finfo->file, "_watched"))
+ xchmod (finfo->file, 1);
+
/* This stuff is just copied blindly from checkout_file. I
don't really know what it does. */
xvers_ts = Version_TS (finfo, options, tag, date,
@@ -2689,7 +2707,7 @@ special_file_mismatch (finfo, rev1, rev2)
rev1_symlink = xreadlink (finfo->file);
else
{
-# ifdef HAVE_ST_RDEV
+# ifdef HAVE_STRUCT_STAT_ST_RDEV
if (CVS_LSTAT (finfo->file, &sb) < 0)
error (1, errno, "could not get file information for %s",
finfo->file);
@@ -2767,7 +2785,7 @@ special_file_mismatch (finfo, rev1, rev2)
rev2_symlink = xreadlink (finfo->file);
else
{
-# ifdef HAVE_ST_RDEV
+# ifdef HAVE_STRUCT_STAT_ST_RDEV
if (CVS_LSTAT (finfo->file, &sb) < 0)
error (1, errno, "could not get file information for %s",
finfo->file);
diff --git a/contrib/cvs/src/version.h.in b/contrib/cvs/src/version.h.in
deleted file mode 100644
index 48580cb..0000000
--- a/contrib/cvs/src/version.h.in
+++ /dev/null
@@ -1,15 +0,0 @@
-/* -*- c -*-
- *
- * Copyright (c) 1992, Brian Berliner and Jeff Polk
- * Copyright (c) 1989-1992, Brian Berliner
- *
- * You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS kit.
- */
-
-#ifndef VERSION_H
-#define VERSION_H 1
-
-#define version_string "Concurrent Versions System (CVS) @VERSION@"
-
-#endif /* VERSION_H */
diff --git a/contrib/cvs/stamp-h1.in b/contrib/cvs/stamp-h1.in
deleted file mode 100644
index 9788f70..0000000
--- a/contrib/cvs/stamp-h1.in
+++ /dev/null
@@ -1 +0,0 @@
-timestamp
OpenPOWER on IntegriCloud