[axel-commits] r6 - in /trunk: axel.c http.c

appaji-guest at users.alioth.debian.org appaji-guest at users.alioth.debian.org
Wed Jan 16 08:11:39 UTC 2008


Author: appaji-guest
Date: Tue Jan 15 16:11:35 2008
New Revision: 6

URL: http://svn.debian.org/wsvn/axel/?sc=1&rev=6
Log:
fix segfaults on HTTP404 and HTTP401 responses

Modified:
    trunk/axel.c
    trunk/http.c

Modified: trunk/axel.c
URL: http://svn.debian.org/wsvn/axel/trunk/axel.c?rev=6&op=diff
==============================================================================
--- trunk/axel.c (original)
+++ trunk/axel.c Tue Jan 15 16:11:35 2008
@@ -444,7 +444,9 @@
 	
 	/* Terminate any thread still running				*/
 	for( i = 0; i < axel->conf->num_connections; i ++ )
-		pthread_cancel( *axel->conn[i].setup_thread );
+		/* don't try to kill non existing thread */
+		if ( *axel->conn[i].setup_thread != 0 )
+			pthread_cancel( *axel->conn[i].setup_thread );
 	
 	/* Delete state file if necessary				*/
 	if( axel->ready == 1 )

Modified: trunk/http.c
URL: http://svn.debian.org/wsvn/axel/trunk/http.c?rev=6&op=diff
==============================================================================
--- trunk/http.c (original)
+++ trunk/http.c Tue Jan 15 16:11:35 2008
@@ -41,7 +41,8 @@
 		sprintf( conn->host, "%s:%i", host, port );
 		if( !conn_set( tconn, proxy ) )
 		{
-			sprintf( conn->request, _("Invalid proxy string: %s\n"), proxy );
+			/* We'll put the message in conn->headers, not in request */
+			sprintf( conn->headers, _("Invalid proxy string: %s\n"), proxy );
 			return( 0 );
 		}
 		host = tconn->host;
@@ -55,7 +56,8 @@
 	
 	if( ( conn->fd = tcp_connect( host, port, conn->local_if ) ) == -1 )
 	{
-		sprintf( conn->request, _("Unable to connect to server %s:%i\n"), host, port );
+		/* We'll put the message in conn->headers, not in request */
+		sprintf( conn->headers, _("Unable to connect to server %s:%i\n"), host, port );
 		return( 0 );
 	}
 	
@@ -145,7 +147,8 @@
 	{
 		if( read( conn->fd, s, 1 ) <= 0 )
 		{
-			sprintf( conn->request, _("Connection gone.\n") );
+			/* We'll put the message in conn->headers, not in request */
+			sprintf( conn->headers, _("Connection gone.\n") );
 			return( 0 );
 		}
 		if( *s == '\r' )




More information about the axel-commits mailing list