apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: apr/misc/unix rand.c
Date Fri, 21 Jun 2002 16:43:07 GMT
trawick     2002/06/21 09:43:07

  Modified:    misc/unix rand.c
  Log:
  report the right error code after I/O with the
  EGD fails
  
  Revision  Changes    Path
  1.12      +7 -4      apr/misc/unix/rand.c
  
  Index: rand.c
  ===================================================================
  RCS file: /home/cvs/apr/misc/unix/rand.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- rand.c	21 Jun 2002 11:33:55 -0000	1.11
  +++ rand.c	21 Jun 2002 16:43:07 -0000	1.12
  @@ -141,8 +141,7 @@
       egd_socket = socket(PF_UNIX, SOCK_STREAM, 0);
   
       if (egd_socket == -1) {
  -        /* Does socket set errno? */
  -        return APR_EGENERAL;
  +        return errno;
       }
   
       rv = connect(egd_socket, (struct sockaddr*)&addr, egd_addr_len);
  @@ -159,9 +158,11 @@
   
           srv = write(egd_socket, req, 2);
           if (srv == -1) {
  +            int bad_errno = errno;
  +
               shutdown(egd_socket, SHUT_RDWR);
               close(egd_socket);
  -            return errno;
  +            return bad_errno;
           }
   
           if (srv != 2) {
  @@ -173,9 +174,11 @@
           resp_expected = req[1];
           srv = read(egd_socket, resp, resp_expected);
           if (srv == -1) {
  +            int bad_errno = errno;
  +
               shutdown(egd_socket, SHUT_RDWR);
               close(egd_socket);
  -            return errno;
  +            return bad_errno;
           }
   
           memcpy(curbuf, resp, srv);
  
  
  

Mime
View raw message