[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Cvs-cvs] ccvs/src ChangeLog client.c recurse.c sanity.sh...
From: |
Derek Robert Price |
Subject: |
[Cvs-cvs] ccvs/src ChangeLog client.c recurse.c sanity.sh... |
Date: |
Thu, 25 Sep 2008 22:26:03 +0000 |
CVSROOT: /cvsroot/cvs
Module name: ccvs
Changes by: Derek Robert Price <dprice> 08/09/25 22:26:02
Modified files:
src : ChangeLog client.c recurse.c sanity.sh server.c
Log message:
* client.c (send_repository, send_dirent_proc), recurse.c
(do_file_proc): Cleanup. Try harder to preserve update_dir.
* server.c: Cleanup.
(output_dir): Become wrapper for...
(output_dir_i): ...this new function used...
(serve_notify): ...here to avoid code duplication.
* sanity.sh (server): Compensate for correct notify repository line.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/ChangeLog?cvsroot=cvs&r1=1.3616&r2=1.3617
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/client.c?cvsroot=cvs&r1=1.478&r2=1.479
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/recurse.c?cvsroot=cvs&r1=1.133&r2=1.134
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/sanity.sh?cvsroot=cvs&r1=1.1211&r2=1.1212
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/server.c?cvsroot=cvs&r1=1.488&r2=1.489
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/ChangeLog,v
retrieving revision 1.3616
retrieving revision 1.3617
diff -u -b -r1.3616 -r1.3617
--- ChangeLog 25 Sep 2008 20:31:37 -0000 1.3616
+++ ChangeLog 25 Sep 2008 22:26:00 -0000 1.3617
@@ -1,5 +1,13 @@
2008-09-25 Derek R. Price <address@hidden>
+ * client.c (send_repository, send_dirent_proc), recurse.c
+ (do_file_proc): Cleanup. Try harder to preserve update_dir.
+ * server.c: Cleanup.
+ (output_dir): Become wrapper for...
+ (output_dir_i): ...this new function used...
+ (serve_notify): ...here to avoid code duplication.
+ * sanity.sh (server): Compensate for correct notify repository line.
+
* create_adm.c: Some quoting and cleanup.
* repos.c (Short_Repository): Improve header comment. Assert truths.
Strip all trailing slashes.
Index: client.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/client.c,v
retrieving revision 1.478
retrieving revision 1.479
diff -u -b -r1.478 -r1.479
--- client.c 19 Sep 2008 16:15:44 -0000 1.478
+++ client.c 25 Sep 2008 22:26:00 -0000 1.479
@@ -3066,8 +3066,6 @@
static void
send_repository (const char *dir, const char *repos, const char *update_dir)
{
- char *adm_name;
-
TRACE (TRACE_FUNCTION, "send_repository (%s, %s, %s)",
dir, repos, update_dir);
@@ -3090,11 +3088,8 @@
this down right now. */
error (1, 0, "no repository");
- if (!update_dir || !*update_dir)
- update_dir = ".";
-
if (last_repos && STREQ (repos, last_repos)
- && last_update_dir && STREQ (update_dir, last_update_dir))
+ && last_update_dir && STREQ (NULL2DOT (update_dir), last_update_dir))
/* We've already sent it. */
return;
@@ -3103,28 +3098,35 @@
/* Add a directory name to the list of those sent to the
server. */
- if (!STREQ (update_dir, ".")
- && !findnode (dirs_sent_to_server, update_dir))
+ if (!STREQ (NULL2DOT (update_dir), ".")
+ && !findnode (dirs_sent_to_server, NULL2DOT (update_dir)))
{
Node *n;
- n = getnode ();
+ n = getnode();
n->type = NT_UNKNOWN;
- n->key = xstrdup (update_dir);
+ n->key = xstrdup (NULL2DOT (update_dir));
n->data = NULL;
if (addnode (dirs_sent_to_server, n))
error (1, 0, "cannot add directory %s to list", n->key);
}
- /* 80 is large enough for any of CVSADM_*. */
- adm_name = xmalloc (strlen (dir) + 80);
-
send_to_server ("Directory ", 0);
{
/* Send the directory name. I know that this
- sort of duplicates code elsewhere, but each
- case seems slightly different... */
- const char *p = update_dir;
+ * sort of duplicates code elsewhere, but each
+ * case seems slightly different...
+ */
+ const char *p;
+
+ /* Old servers don't support preserving update_dir in the Directory
+ * request. See the comment aboce output_dir() for more.
+ */
+ if (supported_request ("Signature"))
+ p = NULL2MT (update_dir);
+ else
+ p = NULL2DOT (update_dir);
+
while (*p)
{
assert (*p != '\012');
@@ -3145,37 +3147,26 @@
if (!STREQ (cvs_cmd_name, "import")
&& supported_request ("Static-directory"))
{
- adm_name[0] = '\0';
- if (dir[0] != '\0')
- {
- strcat (adm_name, dir);
- strcat (adm_name, "/");
- }
- strcat (adm_name, CVSADM_ENTSTAT);
+ char *adm_name = dir_append (dir, CVSADM_ENTSTAT);
if (isreadable (adm_name))
- {
send_to_server ("Static-directory\012", 0);
- }
+ free (adm_name);
}
if (!STREQ (cvs_cmd_name, "import")
&& supported_request ("Sticky"))
{
- FILE *f;
- if (dir[0] == '\0')
- strcpy (adm_name, CVSADM_TAG);
- else
- sprintf (adm_name, "%s/%s", dir, CVSADM_TAG);
-
- f = CVS_FOPEN (adm_name, "r");
+ char *adm_name = dir_append (dir, CVSADM_TAG);
+ FILE *f = CVS_FOPEN (adm_name, "r");
if (!f)
{
- if (! existence_error (errno))
- error (1, errno, "reading %s", adm_name);
+ if (!existence_error (errno))
+ error (1, errno, "reading %s",
+ quote (dir_append (update_dir, CVSADM_TAG)));
}
else
{
char line[80];
- char *nl = NULL;
+ const char *nl = NULL;
send_to_server ("Sticky ", 0);
while (fgets (line, sizeof (line), f))
{
@@ -3187,14 +3178,18 @@
if (!nl)
send_to_server ("\012", 1);
if (fclose (f) == EOF)
- error (0, errno, "closing %s", adm_name);
+ {
+ char *fn = dir_append (update_dir, CVSADM_TAG);
+ error (0, errno, "closing %s", quote (fn));
+ free (fn);
}
}
free (adm_name);
+ }
if (last_repos) free (last_repos);
if (last_update_dir) free (last_update_dir);
last_repos = xstrdup (repos);
- last_update_dir = xstrdup (update_dir);
+ last_update_dir = xstrdup (NULL2DOT (update_dir));
}
@@ -5499,11 +5494,11 @@
TRACE (TRACE_FLOW, "send_dirent_proc (%s, %s, %s)",
dir, repository, update_dir);
- if (ignore_directory (update_dir))
+ if (ignore_directory (NULL2DOT (update_dir)))
{
/* print the warm fuzzy message */
if (!quiet)
- error (0, 0, "Ignoring %s", update_dir);
+ error (0, 0, "Ignoring %s", NULL2DOT (update_dir));
return R_SKIP_ALL;
}
Index: recurse.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/recurse.c,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -b -r1.133 -r1.134
--- recurse.c 20 Sep 2008 00:03:14 -0000 1.133
+++ recurse.c 25 Sep 2008 22:26:01 -0000 1.134
@@ -925,6 +925,8 @@
int ret;
char *tmp;
+ TRACE (TRACE_FLOW, "do_file_proc (%s, %s)", finfo->update_dir, p->key);
+
finfo->file = p->key;
tmp = dir_append (finfo->update_dir, finfo->file);
@@ -1019,27 +1021,7 @@
}
saved_update_dir = update_dir;
- update_dir = xmalloc (strlen (saved_update_dir)
- + strlen (dir)
- + 5);
- strcpy (update_dir, saved_update_dir);
-
- /* set up update_dir - skip dots if not at start */
- if (STREQ (dir, "."))
- {
- if (update_dir[0] == '\0')
- strcpy (update_dir, dir);
- }
- else
- {
- if (update_dir[0])
- {
- strcat (update_dir, "/");
- strcat (update_dir, dir);
- }
- else
- strcpy (update_dir, dir);
- }
+ update_dir = dir_append (saved_update_dir, dir);
/* Here we need a plausible repository name for the sub-directory. We
* create one by concatenating the new directory name onto the previous
Index: sanity.sh
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/sanity.sh,v
retrieving revision 1.1211
retrieving revision 1.1212
diff -u -b -r1.1211 -r1.1212
--- sanity.sh 25 Sep 2008 13:24:35 -0000 1.1211
+++ sanity.sh 25 Sep 2008 22:26:01 -0000 1.1212
@@ -32765,7 +32765,7 @@
# OK, here are some notify tests.
dotest server-6 "${servercvs} server" \
"Notified \./
-${TESTDIR}/crerepos/dir1/file1
+dir1/file1
ok" <<EOF
Root ${TESTDIR}/crerepos
Directory .
@@ -32780,11 +32780,11 @@
dotest server-7 "${servercvs} server" \
"M file1 $username Fri May 7 13:21:09 1999 -0000 myhost
some-work-dir
Notified \./
-${TESTDIR}/crerepos/dir1/file1
+dir1/file1
ok
M file1 $username Fri May 7 13:21:09 1999 -0000 myhost
some-work-dir
Notified \./
-${TESTDIR}/crerepos/dir1/file1
+dir1/file1
ok" <<EOF
Root ${TESTDIR}/crerepos
Directory .
@@ -32803,7 +32803,7 @@
"M file1 $username The 57th day of Discord in the YOLD 3165
myhost some-work-dir
E $CPROG server: invalid character in editor value
Notified \./
-${TESTDIR}/crerepos/dir1/file1
+dir1/file1
ok" <<EOF
Root ${TESTDIR}/crerepos
Directory .
@@ -32858,7 +32858,7 @@
# Now do an unedit.
dotest server-13 "${servercvs} server" \
"Notified \./
-${TESTDIR}/crerepos/dir1/file1
+dir1/file1
ok" <<EOF
Root ${TESTDIR}/crerepos
Directory .
Index: server.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/server.c,v
retrieving revision 1.488
retrieving revision 1.489
diff -u -b -r1.488 -r1.489
--- server.c 19 Sep 2008 16:15:46 -0000 1.488
+++ server.c 25 Sep 2008 22:26:02 -0000 1.489
@@ -215,20 +215,21 @@
/* Allocate some space for our directory-munging string. */
p = xmalloc (strlen (dir) + 1);
- if (p == NULL)
+ if (!p)
return ENOMEM;
dir_where_cvsadm_lives = xmalloc (strlen (base_dir) + strlen (dir) + 100);
- if (dir_where_cvsadm_lives == NULL)
+ if (!dir_where_cvsadm_lives)
{
free (p);
return ENOMEM;
}
/* Allocate some space for the temporary string in which we will
- construct filenames. */
+ * construct filenames.
+ */
tmp = xmalloc (strlen (base_dir) + strlen (dir) + 100);
- if (tmp == NULL)
+ if (!tmp)
{
free (p);
free (dir_where_cvsadm_lives);
@@ -237,11 +238,12 @@
/* We make several passes through this loop. On the first pass,
- we simply create the CVSADM directory in the deepest directory.
- For each subsequent pass, we try to remove the last path
- element from DIR, create the CVSADM directory in the remaining
- pathname, and register the subdirectory in the newly created
- CVSADM directory. */
+ * we simply create the CVSADM directory in the deepest directory.
+ * For each subsequent pass, we try to remove the last path
+ * element from DIR, create the CVSADM directory in the remaining
+ * pathname, and register the subdirectory in the newly created
+ * CVSADM directory.
+ */
retval = done = 0;
@@ -254,7 +256,7 @@
while (1)
{
/* Create CVSADM. */
- (void) sprintf (tmp, "%s/%s", dir_where_cvsadm_lives, CVSADM);
+ sprintf (tmp, "%s/%s", dir_where_cvsadm_lives, CVSADM);
if ((CVS_MKDIR (tmp, 0777) < 0) && (errno != EEXIST))
{
retval = errno;
@@ -262,8 +264,8 @@
}
/* Create CVSADM_REP. */
- (void) sprintf (tmp, "%s/%s", dir_where_cvsadm_lives, CVSADM_REP);
- if (! isfile (tmp))
+ sprintf (tmp, "%s/%s", dir_where_cvsadm_lives, CVSADM_REP);
+ if (!isfile (tmp))
{
/* Use Emptydir as the placeholder until the client sends
us the real value. This code is similar to checkout.c
@@ -271,22 +273,22 @@
differently. */
char *empty;
- empty = xmalloc (strlen (current_parsed_root->directory)
+ empty = malloc (strlen (current_parsed_root->directory)
+ sizeof (CVSROOTADM)
+ sizeof (CVSNULLREPOS)
+ 3);
- if (! empty)
+ if (!empty)
{
retval = ENOMEM;
goto finish;
}
/* Create the directory name. */
- (void) sprintf (empty, "%s/%s/%s", current_parsed_root->directory,
+ sprintf (empty, "%s/%s/%s", current_parsed_root->directory,
CVSROOTADM, CVSNULLREPOS);
/* Create the directory if it doesn't exist. */
- if (! isfile (empty))
+ if (!isfile (empty))
{
mode_t omask;
omask = umask (cvsumask);
@@ -296,11 +298,11 @@
free (empty);
goto finish;
}
- (void) umask (omask);
+ umask (omask);
}
f = CVS_FOPEN (tmp, "w");
- if (f == NULL)
+ if (!f)
{
retval = errno;
free (empty);
@@ -327,9 +329,9 @@
/* Create CVSADM_ENT. We open in append mode because we
don't want to clobber an existing Entries file. */
- (void) sprintf (tmp, "%s/%s", dir_where_cvsadm_lives, CVSADM_ENT);
+ sprintf (tmp, "%s/%s", dir_where_cvsadm_lives, CVSADM_ENT);
f = CVS_FOPEN (tmp, "a");
- if (f == NULL)
+ if (!f)
{
retval = errno;
goto finish;
@@ -340,7 +342,7 @@
goto finish;
}
- if (dir_to_register != NULL)
+ if (dir_to_register)
{
/* FIXME: Yes, this results in duplicate entries in the
Entries.Log file, but it doesn't currently matter. We
@@ -354,13 +356,7 @@
break;
dir_to_register = strrchr (p, '/');
- if (dir_to_register == NULL)
- {
- dir_to_register = p;
- strcpy (dir_where_cvsadm_lives, base_dir);
- done = 1;
- }
- else
+ if (dir_to_register)
{
*dir_to_register = '\0';
dir_to_register++;
@@ -368,6 +364,12 @@
strcat (dir_where_cvsadm_lives, "/");
strcat (dir_where_cvsadm_lives, p);
}
+ else
+ {
+ dir_to_register = p;
+ strcpy (dir_where_cvsadm_lives, base_dir);
+ done = 1;
+ }
}
finish:
@@ -948,22 +950,22 @@
int status;
int i = 0;
- server_temp_dir = xmalloc (strlen (get_cvs_tmp_dir ()) + 80);
+ server_temp_dir = xmalloc (strlen (get_cvs_tmp_dir()) + 80);
if (!server_temp_dir)
{
/* 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");
+ printf ("E Fatal server error, aborting.\n"
+ "error ENOMEM Virtual memory exhausted.\n");
exit (EXIT_FAILURE);
}
- strcpy (server_temp_dir, get_cvs_tmp_dir ());
+ strcpy (server_temp_dir, get_cvs_tmp_dir());
/* Remove a trailing slash from TMPDIR if present. */
p = server_temp_dir + strlen (server_temp_dir) - 1;
- if (*p == '/')
+ if (ISSLASH (*p))
*p = '\0';
/* I wanted to use cvs-serv/PID, but then you have to worry about
@@ -1196,10 +1198,10 @@
FILE *f;
size_t dir_len;
- TRACE (TRACE_FUNCTION, "dirswitch (%s, %s)", dir ? dir : "(null)",
- repos ? repos : "(null)");
+ TRACE (TRACE_FUNCTION, "dirswitch (%s, %s)",
+ TRACE_NULL (dir), TRACE_NULL (repos));
- server_write_entries ();
+ server_write_entries();
if (error_pending()) return;
@@ -1216,51 +1218,60 @@
}
if (pathname_levels (dir) > max_dotdot_limit)
{
- push_pending_error (0, "E protocol error: `%s' has too many ..", dir);
+ push_pending_error (0, "E protocol error: %s has too many ..",
+ quote (dir));
return;
}
dir_len = strlen (dir);
/* Check for a trailing '/'. This is not ISSLASH because \ in the
- protocol is an ordinary character, not a directory separator (of
- course, it is perhaps unwise to use it in directory names, but that
- is another issue). */
- if (dir_len > 0
- && dir[dir_len - 1] == '/')
+ * protocol is an ordinary character, not a directory separator (of
+ * course, it is perhaps unwise to use it in directory names, but that
+ * is another issue).
+ */
+ if (dir_len && dir[dir_len - 1] == '/')
{
push_pending_error (0,
-"E protocol error: invalid directory syntax in %s",
- dir);
+ "E protocol error: invalid directory syntax in %s",
+ quote (dir));
return;
}
- if (gDirname != NULL)
+ if (gDirname)
free (gDirname);
- if (gupdate_dir != NULL)
+ if (gupdate_dir)
free (gupdate_dir);
- if (STREQ (dir, "."))
+ if (!supported_response ("OpenPGP-signature") && STREQ (dir, "."))
+ /* See the comment above output_dir - old clients didn't send the
+ * correct update_dir.
+ */
gupdate_dir = xstrdup ("");
else
gupdate_dir = xstrdup (dir);
- gDirname = xmalloc (strlen (server_temp_dir) + dir_len + 40);
- if (gDirname == NULL)
+ /* This is like dir_append(), but dir_append() doesn't know how to report
+ * errors here.
+ */
+ gDirname = malloc (strlen (server_temp_dir) + dir_len +2);
+ if (!gDirname)
{
pending_error = ENOMEM;
return;
}
-
strcpy (gDirname, server_temp_dir);
+ if (*dir && !STREQ (dir, "."))
+ {
+ if (!ISSLASH (server_temp_dir[strlen (server_temp_dir)]))
strcat (gDirname, "/");
strcat (gDirname, dir);
+ }
status = mkdir_p (gDirname);
- if (status != 0
- && status != EEXIST)
+ if (status && status != EEXIST)
{
- push_pending_error (status, "E cannot mkdir %s", gDirname);
+ push_pending_error (status, "E cannot mkdir %s", quote (gDirname));
return;
}
@@ -1270,8 +1281,8 @@
already-sent "Directory xxx" command. See recurse.c
(start_recursion) for a big discussion of this. */
- status = create_adm_p (server_temp_dir, dir);
- if (status != 0)
+ status = create_adm_p (server_temp_dir, NULL2DOT (dir));
+ if (status)
{
push_pending_error (status, "E cannot create_adm_p %s", gDirname);
return;
@@ -1298,7 +1309,7 @@
correct value. */
f = CVS_FOPEN (CVSADM_REP, "w");
- if (f == NULL)
+ if (!f)
{
push_pending_error (errno, "E cannot open %s/%s", gDirname,
CVSADM_REP);
@@ -1311,21 +1322,6 @@
fclose (f);
return;
}
- /* Non-remote CVS handles a module representing the entire tree
- (e.g., an entry like ``world -a .'') by putting /. at the end
- of the Repository file, so we do the same. */
- if (STREQ (dir, ".")
- && current_parsed_root && current_parsed_root->directory
- && STREQ (current_parsed_root->directory, repos))
- {
- if (fprintf (f, "/.") < 0)
- {
- push_pending_error (errno, "E error writing %s/%s",
- gDirname, CVSADM_REP);
- fclose (f);
- return;
- }
- }
if (fprintf (f, "\n") < 0)
{
push_pending_error (errno, "E error writing %s/%s", gDirname,
@@ -1375,7 +1371,7 @@
int status;
char *repos;
- TRACE (TRACE_FUNCTION, "serve_directory (%s)", arg ? arg : "(null)");
+ TRACE (TRACE_FUNCTION, "serve_directory (%s)", TRACE_NULL (arg));
/* The data needs to be read into the secondary log regardless, but
@@ -1400,8 +1396,7 @@
char *short_repos;
short_repos = repos;
- repos = Xasprintf ("%s/%s",
- current_parsed_root->directory, short_repos);
+ repos = dir_append (current_parsed_root->directory, short_repos);
free (short_repos);
}
else
@@ -1416,28 +1411,13 @@
free (repos);
}
else if (status == -2)
- {
- pending_error = ENOMEM;
- }
- else if (status != 0)
- {
- pending_error_text = xmalloc (80 + strlen (arg));
- if (pending_error_text == NULL)
- {
pending_error = ENOMEM;
- }
else if (status == -1)
- {
- sprintf (pending_error_text,
- "E end of file reading mode for %s", arg);
- }
- else
- {
- sprintf (pending_error_text,
- "E error reading mode for %s", arg);
- pending_error = status;
- }
- }
+ push_pending_error (0, "E end of file reading mode for %s",
+ NULL2DOT (arg));
+ else /* STATUS NOT IN (-2, -1, 0) */
+ push_pending_error (status, "E error reading mode for %s",
+ NULL2DOT (arg));
}
@@ -2983,9 +2963,68 @@
+/* Beginning with 1.12.14, the same release that began supporting PGP
+ * signatures, this function attempts to preserve the difference between ""
+ * and "." in UPDATE_DIR. This corrects some old problems with incorrect
+ * directories being reported in error messages.
+ */
+static void
+output_dir_i (struct buffer *buf, const char *update_dir,
+ const char *repository)
+{
+ /* Set up SHORT_REPOS. */
+ const char *short_repos = Short_Repository (repository);
+
+ /* Send the update_dir/repos. */
+ if (server_dir)
+ {
+ buf_output0 (buf, server_dir);
+ buf_append_char (buf, '/');
+ }
+ if (!*update_dir && !supported_response ("OpenPGP-signature"))
+ buf_append_char (buf, '.');
+ else
+ buf_output0 (buf, update_dir);
+ if (!supported_response ("OpenPGP-signature"))
+ buf_append_char (buf, '/');
+ buf_append_char (buf, '\n');
+ if (!*short_repos)
+ buf_append_char (buf, '.');
+ else
+ buf_output0 (buf, short_repos);
+ buf_append_char (buf, '/');
+}
+
+
+
+static struct buffer *protocol = NULL;
+
+/* This is the output which we are saving up to send to the server, in the
+ * child process. We will push it through, via the `protocol' buffer, when
+ * we have a complete line.u
+ */
+static struct buffer *saved_output;
+
+/* Likewise, but stuff which will go to stderr. */
+static struct buffer *saved_outerr;
+
+
+
+/* Simple wrapper for output_dir_i() that assumes the global PROTOCOL
+ * for BUF.
+ */
+static void
+output_dir (const char *update_dir, const char *repository)
+{
+ output_dir_i (protocol, update_dir, repository);
+}
+
+
+
/* Process all the Notify requests that we have stored up. Returns 0
- if successful, if not prints error message (via error()) and
- returns negative value. */
+ * if successful, if not prints error message (via error()) and
+ * returns negative value.
+ */
static int
server_notify (void)
{
@@ -2994,7 +3033,7 @@
TRACE (TRACE_FUNCTION, "server_notify()");
- while (notify_list != NULL)
+ while (notify_list)
{
if (CVS_CHDIR (notify_list->dir) < 0)
{
@@ -3012,17 +3051,7 @@
notify_list->watches, repos);
buf_output0 (buf_to_net, "Notified ");
- {
- char *dir = notify_list->dir + strlen (server_temp_dir) + 1;
- if (dir[0] == '\0')
- buf_append_char (buf_to_net, '.');
- else
- buf_output0 (buf_to_net, dir);
- buf_append_char (buf_to_net, '/');
- buf_append_char (buf_to_net, '\n');
- }
- buf_output0 (buf_to_net, repos);
- buf_append_char (buf_to_net, '/');
+ output_dir_i (buf_to_net, notify_list->update_dir, repos);
buf_output0 (buf_to_net, notify_list->filename);
buf_append_char (buf_to_net, '\n');
free (repos);
@@ -3308,7 +3337,7 @@
initted = 1;
}
- if (gDirname == NULL)
+ if (!gDirname)
{
push_pending_error (0, "E Protocol error: `Directory' missing");
return;
@@ -3319,13 +3348,10 @@
if (!ign_name (arg))
{
- char *update_dir;
-
buf_output (buf_to_net, "M ? ", 4);
- update_dir = gDirname + strlen (server_temp_dir) + 1;
- if (!(update_dir[0] == '.' && update_dir[1] == '\0'))
+ if (*gupdate_dir)
{
- buf_output0 (buf_to_net, update_dir);
+ buf_output0 (buf_to_net, gupdate_dir);
buf_output (buf_to_net, "/", 1);
}
buf_output0 (buf_to_net, arg);
@@ -3335,18 +3361,6 @@
-static struct buffer *protocol = NULL;
-
-/* This is the output which we are saving up to send to the server, in the
- child process. We will push it through, via the `protocol' buffer, when
- we have a complete line. */
-static struct buffer *saved_output;
-
-/* Likewise, but stuff which will go to stderr. */
-static struct buffer *saved_outerr;
-
-
-
static void
protocol_memory_error (struct buffer *buf)
{
@@ -3603,7 +3617,7 @@
if (lookup_command_attribute (cmd_name)
& CVS_CMD_MODIFIES_REPOSITORY)
{
- become_proxy ();
+ become_proxy();
exit (EXIT_SUCCESS);
}
else if (/* serve_co may have called this already and missing logs
@@ -3636,9 +3650,9 @@
protocol_pipe[0] = -1;
protocol_pipe[1] = -1;
- server_write_entries ();
+ server_write_entries();
- if (print_pending_error ())
+ if (print_pending_error())
goto free_args_and_return;
/* Global `cvs_cmd_name' is probably "server" right now -- only
@@ -3658,7 +3672,7 @@
}
cvs_cmd_name = cmd_name;
- (void) server_notify ();
+ server_notify();
/*
* We use a child process which actually does the operation. This
@@ -3747,12 +3761,12 @@
/* At this point we should no longer be using buf_to_net and
buf_from_net. Instead, everything should go through
protocol. */
- if (buf_to_net != NULL)
+ if (buf_to_net)
{
buf_free (buf_to_net);
buf_to_net = NULL;
}
- if (buf_from_net != NULL)
+ if (buf_from_net)
{
buf_free (buf_from_net);
buf_from_net = NULL;
@@ -3802,7 +3816,8 @@
protocol doesn't support anything better. */
if (! buf_empty_p (saved_output))
{
- buf_output0 (protocol, supported_response ("MT") ? "MT text " : "M
");
+ buf_output0 (protocol,
+ supported_response ("MT") ? "MT text " : "M ");
buf_append_buffer (protocol, saved_output);
buf_output (protocol, "\n", 1);
buf_send_counted (protocol);
@@ -4173,17 +4188,17 @@
* anything left on stdoutbuf or stderrbuf (this could only
* happen if there was no trailing newline), send it over.
*/
- if (! buf_empty_p (stdoutbuf))
+ if (!buf_empty_p (stdoutbuf))
{
buf_append_char (stdoutbuf, '\n');
buf_copy_lines (buf_to_net, stdoutbuf, 'M');
}
- if (! buf_empty_p (stderrbuf))
+ if (!buf_empty_p (stderrbuf))
{
buf_append_char (stderrbuf, '\n');
buf_copy_lines (buf_to_net, stderrbuf, 'E');
}
- if (! buf_empty_p (protocol_inbuf))
+ if (!buf_empty_p (protocol_inbuf))
buf_output0 (buf_to_net,
"E Protocol error: uncounted data discarded\n");
@@ -4397,39 +4412,6 @@
-/* Beginning with 1.12.14, the same release that began supporting PGP
- * signatures, this function attempts to preserve the difference between ""
- * and "." in UPDATE_DIR. This corrects some old problems with incorrect
- * directories being reported in error messages.
- */
-static void
-output_dir (const char *update_dir, const char *repository)
-{
- /* Set up SHORT_REPOS. */
- const char *short_repos = Short_Repository (repository);
-
- /* Send the update_dir/repos. */
- if (server_dir)
- {
- buf_output0 (protocol, server_dir);
- buf_append_char (protocol, '/');
- }
- if (!*update_dir && !supported_response ("OpenPGP-signature"))
- buf_append_char (protocol, '.');
- else
- buf_output0 (protocol, update_dir);
- if (!supported_response ("OpenPGP-signature"))
- buf_append_char (protocol, '/');
- buf_append_char (protocol, '\n');
- if (!*short_repos)
- buf_append_char (protocol, '.');
- else
- buf_output0 (protocol, short_repos);
- buf_append_char (protocol, '/');
-}
-
-
-
/*
* Entries line that we are squirreling away to send to the client when
* we are ready.
@@ -4892,13 +4874,14 @@
# ifdef PROXY_SUPPORT
/* The portions below need not be handled until reprocessing anyhow since
- * there should be no entries or notifications prior to that. */
+ * there should be no entries or notifications prior to that.
+ */
if (!proxy_log)
# endif /* PROXY_SUPPORT */
{
- server_write_entries ();
+ server_write_entries();
if (!pe)
- (void) server_notify ();
+ server_notify();
}
if (!pe
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Cvs-cvs] ccvs/src ChangeLog client.c recurse.c sanity.sh...,
Derek Robert Price <=