1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-12 14:29:28 +00:00

Merge cvs-1.11.2.1-20021201 -> 1.11.5 changes onto mainline

This commit is contained in:
Peter Wemm 2003-01-21 22:01:38 +00:00
parent 3a7972097e
commit 9de666118b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=109660
10 changed files with 91 additions and 102 deletions

View File

@ -108,7 +108,7 @@ allocate_buffer_datas ()
#define ALLOC_COUNT (16)
alc = ((struct buffer_data *)
malloc (ALLOC_COUNT * sizeof (struct buffer_data)));
xmalloc (ALLOC_COUNT * sizeof (struct buffer_data)));
space = (char *) valloc (ALLOC_COUNT * BUFFER_DATA_SIZE);
if (alc == NULL || space == NULL)
return;
@ -156,7 +156,7 @@ buf_empty_p (buf)
#ifdef SERVER_FLOWCONTROL
/*
* Count how much data is stored in the buffer..
* Note that each buffer is a malloc'ed chunk BUFFER_DATA_SIZE.
* Note that each buffer is a xmalloc'ed chunk BUFFER_DATA_SIZE.
*/
int
@ -796,7 +796,7 @@ buf_read_line (buf, line, lenp)
char *p;
struct buffer_data *nldata;
p = malloc (len + 1);
p = xmalloc (len + 1);
if (p == NULL)
return -2;
*line = p;
@ -1235,7 +1235,7 @@ stdio_buffer_initialize (fp, child_pid, input, memory)
int input;
void (*memory) PROTO((struct buffer *));
{
struct stdio_buffer_closure *bc = malloc (sizeof (*bc));
struct stdio_buffer_closure *bc = xmalloc (sizeof (*bc));
bc->fp = fp;
bc->child_pid = child_pid;
@ -1679,7 +1679,7 @@ packetizing_buffer_input (closure, data, need, size, got)
/* We didn't allocate enough space in the initialize
function. */
n = realloc (pb->holdbuf, count + 2);
n = xrealloc (pb->holdbuf, count + 2);
if (n == NULL)
{
(*pb->buf->memory_error) (pb->buf);
@ -1741,7 +1741,7 @@ packetizing_buffer_input (closure, data, need, size, got)
outbuf = stackoutbuf;
else
{
outbuf = malloc (count);
outbuf = xmalloc (count);
if (outbuf == NULL)
{
(*pb->buf->memory_error) (pb->buf);
@ -1813,7 +1813,7 @@ packetizing_buffer_output (closure, data, have, wrote)
if (have > BUFFER_DATA_SIZE)
{
/* It would be easy to malloc a buffer, but I don't think this
/* It would be easy to xmalloc a buffer, but I don't think this
case can ever arise. */
abort ();
}

View File

@ -2179,7 +2179,7 @@ update_entries (data_arg, ent_list, short_pathname, filename)
* date. Create a dummy timestamp which will never compare
* equal to the timestamp of the file.
*/
if (vn[0] == '\0' || vn[0] == '0' || vn[0] == '-')
if (vn[0] == '\0' || strcmp (vn, "0") == 0 || vn[0] == '-')
local_timestamp = "dummy timestamp";
else if (local_timestamp == NULL)
{
@ -3005,7 +3005,7 @@ send_a_repository (dir, repository, update_dir)
&& (strcmp (repository + repository_len - update_dir_len,
update_dir) == 0)
/* TOPLEVEL_REPOS shouldn't be above current_parsed_root->directory */
&& ((repository_len - update_dir_len)
&& ((size_t)(repository_len - update_dir_len)
> strlen (current_parsed_root->directory)))
{
/* The repository name contains UPDATE_DIR. Set
@ -5636,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, LOCK_NONE, (char *)NULL, 0);
argc, argv, local, W_LOCAL, aflag, CVS_LOCK_NONE, (char *)NULL, 0);
if (err)
error_exit ();
if (toplevel_repos == NULL)

View File

@ -249,26 +249,7 @@ find_fileproc (callerdat, finfo)
xfinfo.rcs = NULL;
vers = Version_TS (&xfinfo, NULL, saved_tag, NULL, 0, 0);
if (vers->ts_user == NULL
&& vers->vn_user != NULL
&& (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->vn_user == NULL)
{
if (vers->ts_user == NULL)
error (0, 0, "nothing known about `%s'", finfo->fullname);
@ -278,16 +259,28 @@ find_fileproc (callerdat, finfo)
freevers_ts (&vers);
return 1;
}
else if (vers->ts_user != NULL
&& vers->vn_user != NULL
&& 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. No! Not here. Otherwise, a commit
would succeed in some cases when it should fail. See above. */
if (vers->ts_user == NULL)
{
if (strcmp (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.
FIXME: What classify_file does in this case is print
"new-born %s has disappeared" and removes the entry.
We probably should do the same. */
status = T_ADDED;
else if (vers->vn_user[0] == '-')
status = T_REMOVED;
else
{
/* FIXME: What classify_file does in this case is print
"%s was lost". We probably should do the same. */
freevers_ts (&vers);
return 0;
}
}
else if (strcmp (vers->vn_user, "0") == 0)
status = T_ADDED;
else if (vers->ts_user != NULL
&& vers->ts_rcs != NULL
else if (vers->ts_rcs != NULL
&& (args->force || strcmp (vers->ts_user, vers->ts_rcs) != 0))
/* If we are forcing commits, pretend that the file is
modified. */
@ -428,10 +421,12 @@ commit (argc, argv)
/* numeric specified revision means we ignore sticky tags... */
if (saved_tag && isdigit ((unsigned char) *saved_tag))
{
char *p = saved_tag + strlen (saved_tag);
aflag = 1;
/* strip trailing dots */
while (saved_tag[strlen (saved_tag) - 1] == '.')
saved_tag[strlen (saved_tag) - 1] = '\0';
/* strip trailing dots and leading zeros */
while (*--p == '.') ;
p[1] = '\0';
while (*saved_tag == '0') ++saved_tag;
}
/* some checks related to the "-F logfile" option */
@ -467,7 +462,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, LOCK_NONE,
argc, argv, local, W_LOCAL, 0, CVS_LOCK_NONE,
(char *)NULL, 0);
if (err)
error (1, 0, "correct above errors first!");
@ -648,7 +643,7 @@ commit (argc, argv)
*/
err = start_recursion (check_fileproc, check_filesdoneproc,
check_direntproc, (DIRLEAVEPROC) NULL, NULL, argc,
argv, local, W_LOCAL, aflag, LOCK_NONE,
argv, local, W_LOCAL, aflag, CVS_LOCK_NONE,
(char *) NULL, 1);
if (err)
{
@ -663,7 +658,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, LOCK_NONE,
argc, argv, local, W_LOCAL, aflag, CVS_LOCK_NONE,
(char *) NULL, 1);
/*

View File

@ -16,9 +16,6 @@
#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 */
/* Changed from if __STDC__ to ifdef __STDC__ because of Sun's acc compiler */
@ -270,12 +267,10 @@ extern int errno;
#define CVSREADONLYFS_ENV "CVSREADONLYFS" /* repository is read-only */
#define TMPDIR_ENV "TMPDIR" /* Temporary directory */
/* #define TMPDIR_DFLT Set by options.h */
#define EDITOR1_ENV "CVSEDITOR" /* which editor to use */
#define EDITOR2_ENV "VISUAL" /* which editor to use */
#define EDITOR3_ENV "EDITOR" /* which editor to use */
/* #define EDITOR_DFLT Set by options.h */
#define CVSROOT_ENV "CVSROOT" /* source directory root */
#define CVSROOT_DFLT NULL /* No dflt; must set for checkout */
@ -284,7 +279,6 @@ extern int errno;
#define WRAPPER_ENV "CVSWRAPPERS" /* name of the wrapper file */
#define CVSUMASK_ENV "CVSUMASK" /* Effective umask for repository */
/* #define CVSUMASK_DFLT Set by options.h */
/*
* If the beginning of the Repository matches the following string, strip it
@ -369,9 +363,9 @@ typedef enum direnter_type Dtype;
#endif
/* Recursion processor lock types */
#define LOCK_NONE 0
#define LOCK_READ 1
#define LOCK_WRITE 2
#define CVS_LOCK_NONE 0
#define CVS_LOCK_READ 1
#define CVS_LOCK_WRITE 2
extern char *program_name, *program_path, *command_name;
extern char *Tmpdir, *Editor;

View File

@ -450,7 +450,7 @@ diff (argc, argv)
/* start the recursion processor */
err = start_recursion (diff_fileproc, diff_filesdoneproc, diff_dirproc,
diff_dirleaveproc, NULL, argc, argv, local,
which, 0, LOCK_READ, (char *) NULL, 1);
which, 0, CVS_LOCK_READ, (char *) NULL, 1);
}
/* clean up */

View File

@ -932,7 +932,7 @@ 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, LOCK_NONE,
argv, local, which, aflag, CVS_LOCK_NONE,
(char *) NULL, 0);
sortlist (lock_tree_list, fsortcmp);
if (Writer_Lock (lock_tree_list) != 0)

View File

@ -7570,7 +7570,7 @@ unable to parse %s; `author' not in the expected place", rcsfile);
unable to parse %s; `state' not in the expected place", rcsfile);
vnode->state = rcsbuf_valcopy (rcsbuf, value, 0, (size_t *) NULL);
/* The value is optional, according to rcsfile(5). */
if (value != NULL && STREQ (value, "dead"))
if (value != NULL && STREQ (value, RCSDEAD))
{
vnode->dead = 1;
}
@ -7656,7 +7656,7 @@ unable to parse %s; `state' not in the expected place", rcsfile);
vnode->dead = 1;
if (vnode->state != NULL)
free (vnode->state);
vnode->state = xstrdup ("dead");
vnode->state = xstrdup (RCSDEAD);
continue;
}
/* if we have a new revision number, we're done with this delta */

View File

@ -512,7 +512,7 @@ do_recursion (frame)
if (frame->flags == R_SKIP_ALL)
return (0);
locktype = noexec ? LOCK_NONE : frame->locktype;
locktype = noexec ? CVS_LOCK_NONE : frame->locktype;
/* The fact that locks are not active here is what makes us fail to have
the
@ -552,7 +552,7 @@ do_recursion (frame)
* generating data, to give the buffers a chance to drain to the
* 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)
if (server_active && locktype != CVS_LOCK_NONE)
server_pause_check();
#endif
@ -707,12 +707,12 @@ do_recursion (frame)
/* read lock it if necessary */
if (repository)
{
if (locktype == LOCK_READ)
if (locktype == CVS_LOCK_READ)
{
if (Reader_Lock (repository) != 0)
error (1, 0, "read lock failed - giving up");
}
else if (locktype == LOCK_WRITE)
else if (locktype == CVS_LOCK_WRITE)
lock_dir_for_write (repository);
}
@ -737,7 +737,7 @@ do_recursion (frame)
err += walklist (filelist, do_file_proc, &frfile);
/* unlock it */
if (locktype != LOCK_NONE)
if (locktype != CVS_LOCK_NONE)
Lock_Cleanup ();
/* clean up */

View File

@ -353,17 +353,17 @@ create_adm_p (base_dir, dir)
return 0; /* nothing to do */
/* Allocate some space for our directory-munging string. */
p = malloc (strlen (dir) + 1);
p = xmalloc (strlen (dir) + 1);
if (p == NULL)
return ENOMEM;
dir_where_cvsadm_lives = malloc (strlen (base_dir) + strlen (dir) + 100);
dir_where_cvsadm_lives = xmalloc (strlen (base_dir) + strlen (dir) + 100);
if (dir_where_cvsadm_lives == NULL)
return ENOMEM;
/* Allocate some space for the temporary string in which we will
construct filenames. */
tmp = malloc (strlen (base_dir) + strlen (dir) + 100);
tmp = xmalloc (strlen (base_dir) + strlen (dir) + 100);
if (tmp == NULL)
return ENOMEM;
@ -403,7 +403,7 @@ create_adm_p (base_dir, dir)
differently. */
char *empty;
empty = malloc (strlen (current_parsed_root->directory)
empty = xmalloc (strlen (current_parsed_root->directory)
+ sizeof (CVSROOTADM)
+ sizeof (CVSNULLREPOS)
+ 3);
@ -521,7 +521,7 @@ mkdir_p (dir)
char *dir;
{
char *p;
char *q = malloc (strlen (dir) + 1);
char *q = xmalloc (strlen (dir) + 1);
int retval;
if (q == NULL)
@ -648,7 +648,7 @@ alloc_pending (size)
this case. But we might as well handle it if they don't, I
guess. */
return 0;
pending_error_text = malloc (size);
pending_error_text = xmalloc (size);
if (pending_error_text == NULL)
{
pending_error = ENOMEM;
@ -779,7 +779,7 @@ E Protocol error: Root says \"%s\" but pserver says \"%s\"",
/* Now is a good time to read CVSROOT/options too. */
parseopts(current_parsed_root->directory);
path = malloc (strlen (current_parsed_root->directory)
path = xmalloc (strlen (current_parsed_root->directory)
+ sizeof (CVSROOTADM)
+ 2);
if (path == NULL)
@ -798,7 +798,7 @@ E Protocol error: Root says \"%s\" but pserver says \"%s\"",
free (path);
#ifdef HAVE_PUTENV
env = malloc (strlen (CVSROOT_ENV) + strlen (current_parsed_root->directory) + 2);
env = xmalloc (strlen (CVSROOT_ENV) + strlen (current_parsed_root->directory) + 2);
if (env == NULL)
{
pending_error = ENOMEM;
@ -929,7 +929,7 @@ serve_max_dotdot (arg)
if (lim < 0)
return;
p = malloc (strlen (server_temp_dir) + 2 * lim + 10);
p = xmalloc (strlen (server_temp_dir) + 2 * lim + 10);
if (p == NULL)
{
pending_error = ENOMEM;
@ -978,9 +978,6 @@ dirswitch (dir, repos)
return;
}
if (dir_name != NULL)
free (dir_name);
dir_len = strlen (dir);
/* Check for a trailing '/'. This is not ISDIRSEP because \ in the
@ -996,7 +993,10 @@ dirswitch (dir, repos)
return;
}
dir_name = malloc (strlen (server_temp_dir) + dir_len + 40);
if (dir_name != NULL)
free (dir_name);
dir_name = xmalloc (strlen (server_temp_dir) + dir_len + 40);
if (dir_name == NULL)
{
pending_error = ENOMEM;
@ -1168,7 +1168,7 @@ serve_directory (arg)
}
else
{
pending_error_text = malloc (80 + strlen (arg));
pending_error_text = xmalloc (80 + strlen (arg));
if (pending_error_text == NULL)
{
pending_error = ENOMEM;
@ -1275,7 +1275,7 @@ receive_partial_file (size, file)
pending_error = ENOMEM;
else
{
pending_error_text = malloc (80);
pending_error_text = xmalloc (80);
if (pending_error_text == NULL)
pending_error = ENOMEM;
else if (status == -1)
@ -1362,7 +1362,7 @@ receive_file (size, file, gzipped)
char *filebuf;
char *p;
filebuf = malloc (size);
filebuf = xmalloc (size);
p = filebuf;
/* If NULL, we still want to read the data and discard it. */
@ -1378,7 +1378,7 @@ receive_file (size, file, gzipped)
pending_error = ENOMEM;
else
{
pending_error_text = malloc (80);
pending_error_text = xmalloc (80);
if (pending_error_text == NULL)
pending_error = ENOMEM;
else if (status == -1)
@ -1424,7 +1424,7 @@ receive_file (size, file, gzipped)
if (pending_error_text)
{
char *p = realloc (pending_error_text,
char *p = xrealloc (pending_error_text,
strlen (pending_error_text) + strlen (arg) + 30);
if (p)
{
@ -1481,7 +1481,7 @@ serve_modified (arg)
pending_error = ENOMEM;
else
{
pending_error_text = malloc (80 + strlen (arg));
pending_error_text = xmalloc (80 + strlen (arg));
if (pending_error_text == NULL)
pending_error = ENOMEM;
else
@ -1507,7 +1507,7 @@ serve_modified (arg)
pending_error = ENOMEM;
else
{
pending_error_text = malloc (80 + strlen (arg));
pending_error_text = xmalloc (80 + strlen (arg));
if (pending_error_text == NULL)
pending_error = ENOMEM;
else
@ -1721,13 +1721,13 @@ serve_is_modified (arg)
{
/* We got Is-modified but no Entry. Add a dummy entry.
The "D" timestamp is what makes it a dummy. */
p = (struct an_entry *) malloc (sizeof (struct an_entry));
p = (struct an_entry *) xmalloc (sizeof (struct an_entry));
if (p == NULL)
{
pending_error = ENOMEM;
return;
}
p->entry = malloc (strlen (arg) + 80);
p->entry = xmalloc (strlen (arg) + 80);
if (p->entry == NULL)
{
pending_error = ENOMEM;
@ -1758,14 +1758,14 @@ serve_entry (arg)
struct an_entry *p;
char *cp;
if (error_pending()) return;
p = (struct an_entry *) malloc (sizeof (struct an_entry));
p = (struct an_entry *) xmalloc (sizeof (struct an_entry));
if (p == NULL)
{
pending_error = ENOMEM;
return;
}
/* Leave space for serve_unchanged to write '=' if it wants. */
cp = malloc (strlen (arg) + 2);
cp = xmalloc (strlen (arg) + 2);
if (cp == NULL)
{
pending_error = ENOMEM;
@ -1807,7 +1807,7 @@ serve_kopt (arg)
return;
}
kopt = malloc (strlen (arg) + 1);
kopt = xmalloc (strlen (arg) + 1);
if (kopt == NULL)
{
pending_error = ENOMEM;
@ -1901,13 +1901,13 @@ server_write_entries ()
}
struct notify_note {
/* Directory in which this notification happens. malloc'd*/
/* Directory in which this notification happens. xmalloc'd*/
char *dir;
/* malloc'd. */
/* xmalloc'd. */
char *filename;
/* The following three all in one malloc'd block, pointed to by TYPE.
/* The following three all in one xmalloc'd block, pointed to by TYPE.
Each '\0' terminated. */
/* "E" or "U". */
char *type;
@ -1940,14 +1940,14 @@ serve_notify (arg)
if (dir_name == NULL)
goto error;
new = (struct notify_note *) malloc (sizeof (struct notify_note));
new = (struct notify_note *) xmalloc (sizeof (struct notify_note));
if (new == NULL)
{
pending_error = ENOMEM;
return;
}
new->dir = malloc (strlen (dir_name) + 1);
new->filename = malloc (strlen (arg) + 1);
new->dir = xmalloc (strlen (dir_name) + 1);
new->filename = xmalloc (strlen (arg) + 1);
if (new->dir == NULL || new->filename == NULL)
{
pending_error = ENOMEM;
@ -1966,7 +1966,7 @@ serve_notify (arg)
pending_error = ENOMEM;
else
{
pending_error_text = malloc (80 + strlen (arg));
pending_error_text = xmalloc (80 + strlen (arg));
if (pending_error_text == NULL)
pending_error = ENOMEM;
else
@ -2126,7 +2126,7 @@ serve_argument (arg)
{
argument_vector_size *= 2;
argument_vector =
(char **) realloc ((char *)argument_vector,
(char **) xrealloc ((char *)argument_vector,
argument_vector_size * sizeof (char *));
if (argument_vector == NULL)
{
@ -2134,7 +2134,7 @@ serve_argument (arg)
return;
}
}
p = malloc (strlen (arg) + 1);
p = xmalloc (strlen (arg) + 1);
if (p == NULL)
{
pending_error = ENOMEM;
@ -2153,7 +2153,7 @@ serve_argumentx (arg)
if (error_pending()) return;
p = argument_vector[argument_count - 1];
p = realloc (p, strlen (p) + 1 + strlen (arg) + 1);
p = xrealloc (p, strlen (p) + 1 + strlen (arg) + 1);
if (p == NULL)
{
pending_error = ENOMEM;
@ -3864,7 +3864,7 @@ serve_co (arg)
* The client has not sent a "Repository" line. Check out
* into a pristine directory.
*/
tempdir = malloc (strlen (server_temp_dir) + 80);
tempdir = xmalloc (strlen (server_temp_dir) + 80);
if (tempdir == NULL)
{
buf_output0 (buf_to_net, "E Out of memory\n");
@ -5067,7 +5067,7 @@ server (argc, argv)
int status;
int i = 0;
server_temp_dir = malloc (strlen (Tmpdir) + 80);
server_temp_dir = xmalloc (strlen (Tmpdir) + 80);
if (server_temp_dir == NULL)
{
/*

View File

@ -500,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, LOCK_READ,
argc, argv, local, which, aflag, CVS_LOCK_READ,
preload_update_dir, 1);
if (err)
return (err);
@ -516,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, LOCK_READ,
argc, argv, local, which, aflag, CVS_LOCK_READ,
preload_update_dir, 1);
#ifdef SERVER_SUPPORT