You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by tr...@apache.org on 2001/01/09 00:52:01 UTC

cvs commit: apr/test testmmap.c

trawick     01/01/08 15:52:00

  Modified:    test     testmmap.c
  Log:
  get rid of a bogus use of perror()
  
  Revision  Changes    Path
  1.21      +12 -4     apr/test/testmmap.c
  
  Index: testmmap.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testmmap.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- testmmap.c	2000/12/10 21:43:11	1.20
  +++ testmmap.c	2001/01/08 23:51:59	1.21
  @@ -77,7 +77,9 @@
       apr_file_t *thefile = NULL;
       apr_finfo_t finfo;
       apr_int32_t flag = APR_READ;
  +    apr_status_t rv;
       char *file1;
  +    char errmsg[120];
       
       fprintf (stdout,"APR MMAP Test\n*************\n\n");
       
  @@ -101,8 +103,11 @@
       strncat(file1,"/testmmap.c",11);  
   
       fprintf(stdout, "Opening file........................");
  -    if (apr_open(&thefile, file1, flag, APR_UREAD | APR_GREAD, context) != APR_SUCCESS) {
  -        perror("Didn't open file");
  +    rv = apr_open(&thefile, file1, flag, APR_UREAD | APR_GREAD, context);
  +    if (rv != APR_SUCCESS) {
  +        fprintf(stderr,
  +                "couldn't open file `%s': %d/%s\n",
  +                file1, rv, apr_strerror(rv, errmsg, sizeof errmsg));
           exit(-1);
       }
       else {
  @@ -110,8 +115,11 @@
       }
       
       fprintf(stderr, "Getting file size...................");
  -    if (apr_getfileinfo(&finfo, thefile) != APR_SUCCESS) {
  -        perror("Didn't get file information!");
  +    rv = apr_getfileinfo(&finfo, thefile);
  +    if (rv != APR_SUCCESS) {
  +        fprintf(stderr,
  +                "Didn't get file information: %d/%s\n",
  +                rv, apr_strerror(rv, errmsg, sizeof errmsg));
           exit(-1);
       }
       else {