summaryrefslogtreecommitdiff
path: root/user/libcddb/connect-ppc64.patch
blob: 0c79fdc4d55abd233726cdc8fcf624da97073e0d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--- 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 */