From 6045cae71a438a752980a395f03717a13cc22179 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 15 Apr 2004 01:01:56 +0000 Subject: Import cvs-1.11.15 --- contrib/cvs/src/release.c | 56 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 17 deletions(-) (limited to 'contrib/cvs/src/release.c') diff --git a/contrib/cvs/src/release.c b/contrib/cvs/src/release.c index f87583d..2d8c72c 100644 --- a/contrib/cvs/src/release.c +++ b/contrib/cvs/src/release.c @@ -94,7 +94,7 @@ release (argc, argv) case 'q': error (1, 0, "-q or -Q must be specified before \"%s\"", - command_name); + cvs_cmd_name); break; case 'd': delete_flag++; @@ -116,12 +116,17 @@ release (argc, argv) * up to the user to take note of them, at least currently * (ignore-193 in testsuite)). */ - /* Construct the update command. */ + /* Construct the update command. Be sure to add authentication and + encryption if we are using them currently, else our child process may + not be able to communicate with the server. */ update_cmd = xmalloc (strlen (program_path) - + strlen (current_parsed_root->original) - + 20); - sprintf (update_cmd, "%s -n -q -d %s update", - program_path, current_parsed_root->original); + + strlen (current_parsed_root->original) + + 1 + 3 + 3 + 16 + 1); + sprintf (update_cmd, "%s %s%s-n -q -d %s update", + program_path, + cvsauthenticate ? "-a " : "", + cvsencrypt ? "-x " : "", + current_parsed_root->original); #ifdef CLIENT_SUPPORT /* Start the server; we'll close it after looping. */ @@ -216,7 +221,7 @@ release (argc, argv) if (c) /* "No" */ { (void) fprintf (stderr, "** `%s' aborted by user choice.\n", - command_name); + cvs_cmd_name); free (repository); if (restore_cwd (&cwd, NULL)) error_exit (); @@ -224,6 +229,17 @@ release (argc, argv) } } + /* Note: client.c doesn't like to have other code + changing the current directory on it. So a fair amount + of effort is needed to make sure it doesn't get confused + about the directory and (for example) overwrite + CVS/Entries file in the wrong directory. See release-17 + through release-23. */ + + free (repository); + if (restore_cwd (&cwd, NULL)) + exit (EXIT_FAILURE); + if (1 #ifdef CLIENT_SUPPORT && !(current_parsed_root->isremote @@ -232,13 +248,14 @@ release (argc, argv) #endif ) { - /* We are chdir'ed into the directory in question. - So don't pass args to unedit. */ - int argc = 1; + int argc = 2; char *argv[3]; argv[0] = "dummy"; - argv[1] = NULL; + argv[1] = thisarg; + argv[2] = NULL; err += unedit (argc, argv); + if (restore_cwd (&cwd, NULL)) + exit (EXIT_FAILURE); } #ifdef CLIENT_SUPPORT @@ -255,11 +272,6 @@ release (argc, argv) history_write ('F', thisarg, "", thisarg, ""); /* F == Free */ } - free (repository); - - if (restore_cwd (&cwd, NULL)) - error_exit (); - if (delete_flag) { /* FIXME? Shouldn't this just delete the CVS-controlled @@ -272,7 +284,17 @@ release (argc, argv) #ifdef CLIENT_SUPPORT if (current_parsed_root->isremote) - err += get_server_responses (); + { + /* FIXME: + * Is there a good reason why get_server_responses() isn't + * responsible for restoring its initial directory itself when + * finished? + */ + err += get_server_responses (); + + if (restore_cwd (&cwd, NULL)) + exit (EXIT_FAILURE); + } #endif /* CLIENT_SUPPORT */ } -- cgit v1.1