httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@locus.apache.org
Subject cvs commit: apache-2.0/src/support ab.c
Date Mon, 31 Jul 2000 14:50:59 GMT
trawick     00/07/31 07:50:55

  Modified:    src      CHANGES
               src/support ab.c
  Log:
  Don't use perror() to report the failure of an APR function.
  Introduce apr_err() for that purpose.
  
  Revision  Changes    Path
  1.187     +3 -0      apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.186
  retrieving revision 1.187
  diff -u -r1.186 -r1.187
  --- CHANGES	2000/07/31 01:39:51	1.186
  +++ CHANGES	2000/07/31 14:50:43	1.187
  @@ -1,4 +1,7 @@
   Changes with Apache 2.0a5
  +  *) ab: don't use perror() to report the failure of an APR function.
  +     [Jeff Trawick]
  +
     *) Make dexter, mpmt_pthread, and perchild MPMs not destroy the
        scoreboard on graceful restarts.
        [Ryan Bloom]
  
  
  
  1.20      +28 -19    apache-2.0/src/support/ab.c
  
  Index: ab.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/support/ab.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- ab.c	2000/07/16 00:06:39	1.19
  +++ ab.c	2000/07/31 14:50:50	1.20
  @@ -230,17 +230,24 @@
   
   /* --------------------------------------------------------- */
   
  -/* simple little function to perror and exit */
  +/* simple little function to write an error string and exit */
   
   static void err(char *s)
   {
  -    if (errno) {
  -        perror(s);
  -    }
  -    else {
  -        printf("%s", s);
  -    }
  -    exit(errno);
  +    fprintf(stderr, "%s", s);
  +    exit(1);
  +}
  +
  +/* simple little function to write an APR error string and exit */
  +
  +static void apr_err(char *s, ap_status_t rv)
  +{
  +    char buf[120];
  +
  +    fprintf(stderr,
  +            "%s: %s (%d)\n", 
  +            s, ap_strerror(rv, buf, sizeof buf), rv);
  +    exit(rv);
   }
   
   /* --------------------------------------------------------- */
  @@ -483,11 +490,11 @@
       c->cbx = 0;
       c->gotheader = 0;
   
  -    if (ap_create_tcp_socket(&c->aprsock, cntxt) != APR_SUCCESS) {
  -        err("Socket:");
  +    if ((rv = ap_create_tcp_socket(&c->aprsock, cntxt)) != APR_SUCCESS) {
  +        apr_err("Socket:", rv);
       }
  -    if (ap_set_remote_port(c->aprsock, port) != APR_SUCCESS) {
  -        err("Port:");
  +    if ((rv = ap_set_remote_port(c->aprsock, port)) != APR_SUCCESS) {
  +        apr_err("Port:", rv);
       }
       c->start = ap_now();
       if ((rv = ap_connect(c->aprsock, hostname)) != APR_SUCCESS) {
  @@ -501,7 +508,9 @@
               ap_close_socket(c->aprsock);
               err_conn++;
               if (bad++ > 10) {
  -                err("\nTest aborted after 10 failures\n\n");
  +                fprintf(stderr,
  +                        "\nTest aborted after 10 failures\n\n");
  +                apr_err("ap_connect()", rv);
               }
               start_connect(c);
               return;
  @@ -725,8 +734,8 @@
       ap_interval_time_t timeout;
       ap_int16_t rv;
       int i;
  -#ifdef NOT_ASCII
       ap_status_t status;
  +#ifdef NOT_ASCII
       ap_size_t inbytes_left, outbytes_left;
   #endif
   
  @@ -814,13 +823,13 @@
           timeout = 30 * AP_USEC_PER_SEC;
   
           n = concurrency;
  -        ap_poll(readbits, &n, timeout);
  +        status = ap_poll(readbits, &n, timeout);
  +        if (status != APR_SUCCESS)
  +            apr_err("ap_poll", status);
   
           if (!n) {
               err("\nServer timed out\n\n");
           }
  -        if (n < 1)
  -            err("ap_poll");
   
           for (i = 0; i < concurrency; i++) {
               ap_get_revents(&rv, con[i].aprsock, readbits);
  @@ -853,14 +862,14 @@
   static void copyright(void)
   {
       if (!use_html) {
  -        printf("This is ApacheBench, Version %s\n", AB_VERSION " <$Revision: 1.19 $>
apache-2.0");
  +        printf("This is ApacheBench, Version %s\n", AB_VERSION " <$Revision: 1.20 $>
apache-2.0");
           printf("Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n");
           printf("Copyright (c) 1998-2000 The Apache Software Foundation, http://www.apache.org/\n");
           printf("\n");
       }
       else {
           printf("<p>\n");
  -        printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i>
apache-2.0<br>\n", AB_VERSION, "$Revision: 1.19 $");
  +        printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i>
apache-2.0<br>\n", AB_VERSION, "$Revision: 1.20 $");
           printf(" Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br>\n");
           printf(" Copyright (c) 1998-2000 The Apache Software Foundation, http://www.apache.org/<br>\n");
           printf("</p>\n<p>\n");
  
  
  

Mime
View raw message