--- pnscan-1.11.orig/pnscan.c
+++ pnscan-1.11/pnscan.c
@@ -590,10 +590,11 @@
     {
 	if (verbose)
 	{
+	    int old_errno = errno;
 	    pthread_mutex_lock(&print_lock);
 	    
 	    print_host(stderr, sin.sin_addr, port);
-	    fprintf(stderr, " : ERR : connect() failed: %s\n", strerror(errno));
+	    fprintf(stderr, " : ERR : connect() failed: %s\n", strerror(old_errno));
 	    
 	    pthread_mutex_unlock(&print_lock);
 	}
@@ -609,10 +610,11 @@
 	{
 	    if (verbose)
 	    {
+		int old_errno = errno;
 		pthread_mutex_lock(&print_lock);
 		
 		print_host(stderr, sin.sin_addr, port);
-		fprintf(stderr, " : ERR : write() failed: %s\n", strerror(errno));
+		fprintf(stderr, " : ERR : write() failed: %s\n", strerror(old_errno));
 		
 		pthread_mutex_unlock(&print_lock);
 	    }
@@ -632,10 +634,11 @@
     {
 	if (verbose)
 	{
+	    int old_errno = errno;
 	    pthread_mutex_lock(&print_lock);
 	    
 	    print_host(stderr, sin.sin_addr, port);
-	    fprintf(stderr, " : ERR : read() failed: %s\n", strerror(errno));
+	    fprintf(stderr, " : ERR : read() failed: %s\n", strerror(old_errno));
 	    
 	    pthread_mutex_unlock(&print_lock);
 	}
