| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324 |
- Index: src/server.c
- ===================================================================
- RCS file: /cvs/ccvs/src/server.c,v
- diff -u -d -r1.275 -r1.277
- --- src/server.c 18 Jun 2002 13:35:28 -0000 1.275
- +++ src/server.c 14 Aug 2002 13:21:55 -0000 1.277
- @@ -5010,6 +5010,8 @@
- int argc;
- char **argv;
- {
- + char *error_prog_name; /* Used in error messages */
- +
- if (argc == -1)
- {
- static const char *const msg[] =
- @@ -5165,39 +5167,18 @@
- /* 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)
- {
- @@ -5270,6 +5251,7 @@
- }
- free (orig_cmd);
- }
- + free(error_prog_name);
- server_cleanup (0);
- return 0;
- }
- @@ -5419,8 +5401,8 @@
- 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.
- */
-
- @@ -5578,7 +5560,7 @@
- {
- /* 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;
- Index: src/server.c
- ===================================================================
- RCS file: /cvs/ccvs/src/server.c,v
- diff -u -d -r1.279 -r1.280
- --- src/server.c 16 Sep 2002 14:56:25 -0000 1.279
- +++ src/server.c 4 Oct 2002 19:56:01 -0000 1.280
- @@ -3213,10 +3213,13 @@
- 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)
- @@ -4891,9 +4894,9 @@
-
- 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)
- @@ -4902,6 +4905,9 @@
- {
- (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;
- }
- @@ -5003,6 +5009,9 @@
- {
- (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;
- }
- }
-
- @@ -5146,25 +5155,6 @@
- }
- }
-
- -#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. */
- @@ -6352,12 +6342,12 @@
- 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');
- Index: src/server.c
- ===================================================================
- RCS file: /cvs/ccvs/src/server.c,v
- diff -u -d -r1.280 -r1.281
- --- src/server.c 4 Oct 2002 19:56:01 -0000 1.280
- +++ src/server.c 25 Oct 2002 19:35:07 -0000 1.281
- @@ -710,17 +710,7 @@
- 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;
- @@ -5080,18 +5070,7 @@
- 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);
-
- @@ -5575,17 +5554,7 @@
- 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
- @@ -5635,16 +5604,7 @@
- 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
- {
- @@ -5901,12 +5861,8 @@
- {
- 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
- @@ -5932,12 +5888,8 @@
- {
- 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));
- @@ -5948,12 +5900,8 @@
- {
- 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. */
- Index: src/buffer.c
- ===================================================================
- RCS file: /cvs/ccvs/src/buffer.c,v
- diff -u -d -r1.19 -r1.20
- --- src/buffer.c 20 May 2002 18:27:55 -0000 1.19
- +++ src/buffer.c 24 Oct 2002 19:54:58 -0000 1.20
- @@ -1392,8 +1392,7 @@
-
- if (buf->input)
- {
- - if (! buf_empty_p (buf)
- - || getc (bc->fp) != EOF)
- + if ( !buf_empty_p (buf) )
- {
- # ifdef SERVER_SUPPORT
- if (server_active)
|