--- libcddb-1.3.2/lib/cddb_net.c.old	2009-03-01 03:28:07.000000000 +0000
+++ libcddb-1.3.2/lib/cddb_net.c	2019-01-03 06:43:42.480000000 +0000
@@ -273,7 +273,7 @@
 int timeout_connect(int sockfd, const struct sockaddr *addr, 
                     size_t len, int timeout)
 {
-    int got_error = 0;
+    int got_error = 0, conn_result;
 
     /* set socket to non-blocking */
 #ifdef BEOS
@@ -299,7 +299,7 @@
 #endif /* BEOS */
 
     /* try connecting */
-    if (connect(sockfd, addr, len) == -1) {
+    if ((conn_result = connect(sockfd, addr, len)) == -1) {
         /* check whether we can continue */
         if (errno == EINPROGRESS) {
             int rv;
@@ -333,6 +333,9 @@
                 }
             }
         }
+    } else if (conn_result == 0) {
+        /* it worked without needing timeout */
+        got_error = 0;
     } else {
         /* connect failed */
         got_error = -1;
--- libcddb-1.3.2/lib/cddb_net.c.old	2009-03-01 03:28:07.000000000 +0000
+++ libcddb-1.3.2/lib/cddb_net.c	2019-01-03 07:30:27.050000000 +0000
@@ -325,6 +325,8 @@
             default:
                 /* we got connected, check error condition */
                 l = sizeof(rv);
+		/* Work around Linux/ppc64 bug */
+		rv = 0;
                 getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &rv, &l);
                 if (rv) {
                     /* something went wrong, simulate normal connect behaviour */