summaryrefslogtreecommitdiff
path: root/debian/patches/85_timer_settime.patch
blob: 1ac1942d1f79f5dd1251394cbdf5eb716f44807a (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
#! /bin/sh /usr/share/dpatch/dpatch-run
## 85_timer_settime.dpatch by  <mstone@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: timeout ignores fractional part of sleep times when timeout is more 
## DP: than 100000s (approximately 1 day) on kfbsd. prevents failure modes 
## DP: in libc implementation when timeout approaches max(time_t)

@DPATCH@
Index: b/src/timeout.c
===================================================================
--- a/src/timeout.c
+++ b/src/timeout.c
@@ -133,6 +133,11 @@ settimeout (double duration, bool warn)
    resolution provided by alarm().  */
 
 #if HAVE_TIMER_SETTIME
+#ifdef __FreeBSD_kernel__
+if (duration < 100000) {
+#else
+if (true) {
+#endif 
   struct timespec ts = dtotimespec (duration);
   struct itimerspec its = { {0, 0}, ts };
   timer_t timerid;
@@ -149,6 +154,7 @@ settimeout (double duration, bool warn)
     }
   else if (warn && errno != ENOSYS)
     error (0, errno, _("warning: timer_create"));
+}
 #endif
 
   unsigned int timeint;