httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: httpd-2.0/support ab.c
Date Fri, 12 Jan 2001 14:28:19 GMT
trawick     01/01/12 06:28:19

  Modified:    support  ab.c
  Log:
  open_postfile():
    fix some return codes along the lines of OtherBill's comment
    fix some bad conditional logic for when to check if we read the
      wrong number of bytes
  
  Revision  Changes    Path
  1.48      +20 -10    httpd-2.0/support/ab.c
  
  Index: ab.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/support/ab.c,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- ab.c	2001/01/09 04:48:18	1.47
  +++ ab.c	2001/01/12 14:28:17	1.48
  @@ -896,14 +896,14 @@
   static void copyright(void)
   {
       if (!use_html) {
  -        printf("This is ApacheBench, Version %s\n", AB_VERSION " <$Revision: 1.47 $>
apache-2.0");
  +        printf("This is ApacheBench, Version %s\n", AB_VERSION " <$Revision: 1.48 $>
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.47 $");
  +        printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i>
apache-2.0<br>\n", AB_VERSION, "$Revision: 1.48 $");
           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");
  @@ -985,10 +985,14 @@
       apr_finfo_t finfo;
       apr_fileperms_t mode = APR_OS_DEFAULT;
       apr_size_t length;
  +    apr_status_t rv;
  +    char errmsg[120];
   
  -    if (apr_open(&postfd, pfile, APR_READ, mode, cntxt) != APR_SUCCESS) {
  -        printf("Invalid postfile name (%s)\n", pfile);
  -        return ENOENT;
  +    rv = apr_open(&postfd, pfile, APR_READ, mode, cntxt);
  +    if (rv != APR_SUCCESS) {
  +        printf("Invalid postfile name (%s): %s\n", pfile,
  +               apr_strerror(rv, errmsg, sizeof errmsg));
  +        return rv;
       }
   
       apr_getfileinfo(&finfo, postfd);
  @@ -996,13 +1000,19 @@
       postdata = (char *)malloc(postlen);
       if (!postdata) {
           printf("Can\'t alloc postfile buffer\n");
  -        return ENOMEM;
  +        return APR_ENOMEM;
       }
       length = postlen;
  -    if (apr_read(postfd, postdata, &length) != APR_SUCCESS &&
  -        length != postlen) {
  -        printf("error reading postfilen");
  -        return EIO;
  +    rv = apr_read(postfd, postdata, &length);
  +    if (rv != APR_SUCCESS) {
  +        printf("error reading postfile: %s\n",
  +               apr_strerror(rv, errmsg, sizeof errmsg));
  +        return rv;
  +    }
  +    if (length != postlen) {
  +        printf("error reading postfile: read only %d bytes",
  +               length);
  +        return APR_EINVAL;
       }
       return 0;
   }
  
  
  

Mime
View raw message