summaryrefslogtreecommitdiffstats
path: root/net/delegate/files/patch-aa
blob: 914a4c3e4b55587ae0f8fc2f6c35b225741b72cf (plain)
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
--- src/lock.c.orig	Mon Mar 15 19:24:15 1999
+++ src/lock.c	Sun Apr 18 15:26:15 1999
@@ -136,6 +136,22 @@
 			break;
 		}
 
+#ifdef EWOULDBLOCK
+		/*
+		 * Only retry the lock if it was busy.  Other
+		 * possible sources for the lock to fail are:
+		 * invalid argument, bad filedescriptor, and
+		 * operation not supported by device.  The latter
+		 * happens if you start DeleGateD with -v, so it
+		 * logs to stderr (which usually doesn't support
+		 * locking at all).
+		 */
+		if (rcode == -1 && errno != EWOULDBLOCK) {
+			/* pretend lock succeeded */
+			rcode = 0;
+			break;
+		}
+#endif
 		remain = timeout - elapsed;
 		if( remain <= 0 )
 			break;
@@ -146,6 +162,13 @@
 
 			start = Time();
 			rcode = callFuncTimeout(remain/1000,-1,func,fd);
+#ifdef EWOULDBLOCK
+			if (rcode == -1 && errno != EWOULDBLOCK) {
+				/* pretend lock succeeded */
+				rcode = 0;
+				break;
+			}
+#endif
 			elapse1 = (Time() - start) * 1000; 
 /*{
 static int n;
OpenPOWER on IntegriCloud