Changeset 3745

Show
Ignore:
Timestamp:
08/27/08 21:11:48
Author:
pvanhoof
Message:

2008-08-27 Martin Bonnin <martinbonnin@gmail.com>

        • This removes the "Warning: invalid file descriptor -1 in

syscall

close()" seen when using valgrind with tinymail. stream_close()
is
called twice in a row on the same stream. There might be more
implications than just this valgrind warning, full details here
http://www.tinymail.org/trac/tinymail/ticket/62#preview

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r3743 r3745  
     12008-08-27  Martin Bonnin  <martinbonnin@gmail.com> 
     2 
     3        * This removes the "Warning: invalid file descriptor -1 in syscall  
     4        close()" seen when using valgrind with tinymail. stream_close() is  
     5        called twice in a row on the same stream.  There might be more  
     6        implications than just this valgrind warning, full details here  
     7        http://www.tinymail.org/trac/tinymail/ticket/62#preview 
     8 
    192008-08-22  Philip Van Hoof  <philip@codeminded.be> 
    210 
  • trunk/libtinymail-camel/camel-lite/camel/camel-tcp-stream-openssl.c

    r3697 r3745  
    692692stream_close (CamelStream *stream) 
    693693{ 
    694         close_ssl_connection (((CamelTcpStreamSSL *)stream)->priv->ssl); 
    695         ((CamelTcpStreamSSL *)stream)->priv->ssl = NULL; 
    696  
    697         if (close (((CamelTcpStreamSSL *)stream)->priv->sockfd) == -1) 
    698                 return -1; 
    699  
    700         ((CamelTcpStreamSSL *)stream)->priv->sockfd = -1; 
     694        if( ((CamelTcpStreamSSL *)stream)->priv->ssl ){ 
     695                close_ssl_connection (((CamelTcpStreamSSL *)stream)->priv->ssl); 
     696                ((CamelTcpStreamSSL *)stream)->priv->ssl = NULL; 
     697        } 
     698 
     699        if( ((CamelTcpStreamSSL *)stream)->priv->sockfd != -1 ){ 
     700                if (close (((CamelTcpStreamSSL *)stream)->priv->sockfd) == -1) 
     701                        return -1; 
     702 
     703                ((CamelTcpStreamSSL *)stream)->priv->sockfd = -1; 
     704        } 
     705 
    701706        return 0; 
    702707}