The Samba-Bugzilla – Attachment 10142 Details for
Bug 10731
sys_poll_intr(): wrong unit for timeout value
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for v4-1
10731.patch (text/plain), 1.61 KB, created by
Volker Lendecke
on 2014-07-22 08:27:20 UTC
(
hide
)
Description:
Patch for v4-1
Filename:
MIME Type:
Creator:
Volker Lendecke
Created:
2014-07-22 08:27:20 UTC
Size:
1.61 KB
patch
obsolete
>From acead642322b59ce9663f819bbce35c1525724fd Mon Sep 17 00:00:00 2001 >From: Daniel Kobras <d.kobras@science-computing.de> >Date: Mon, 21 Jul 2014 10:47:53 +0200 >Subject: [PATCH] sys_poll_intr: fix timeout arithmetic > >Callers of sys_poll_intr() assume timeout to be in milliseconds like >poll(2) expects, but implementation used nanosecond units. Also make >sure timeout doesn't become infinite by mistake during time arithmetic. > >Signed-off-by: Daniel Kobras <d.kobras@science-computing.de> >Reviewed-by: Volker Lendecke <vl@samba.org> >Reviewed-by: Stefan Metzmacher <metze@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> >Bug: https://bugzilla.samba.org/show_bug.cgi?id=10731 > >Autobuild-User(master): Jeremy Allison <jra@samba.org> >Autobuild-Date(master): Tue Jul 22 00:12:24 CEST 2014 on sn-devel-104 >--- > lib/util/select.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > >diff --git a/lib/util/select.c b/lib/util/select.c >index 5e66344..99cd772 100644 >--- a/lib/util/select.c >+++ b/lib/util/select.c >@@ -42,9 +42,19 @@ int sys_poll_intr(struct pollfd *fds, int num_fds, int timeout) > if (errno != EINTR) { > break; > } >+ /* Infinite timeout, no need to adjust. */ >+ if (timeout < 0) { >+ continue; >+ } > clock_gettime_mono(&now); >- elapsed = nsec_time_diff(&now, &start); >- timeout = (orig_timeout - elapsed) / 1000000; >+ elapsed = nsec_time_diff(&now, &start) / 1000000; >+ timeout = orig_timeout - elapsed; >+ /* Unlikely, but might happen eg. when getting traced. >+ * Make sure we're not hanging in this case. >+ */ >+ if (timeout < 0) { >+ timeout = 0; >+ } > }; > return ret; > } >-- >1.7.9.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
metze
:
review+
Actions:
View
Attachments on
bug 10731
:
10130
|
10133
| 10142