]> git.pld-linux.org Git - packages/libgcrypt.git/blame - libgcrypt-poll.patch
- updated to 1.7.0
[packages/libgcrypt.git] / libgcrypt-poll.patch
CommitLineData
c4b9e883
JB
1--- libgcrypt-1.6.0/random/rndlinux.c.orig 2013-12-16 11:44:25.000000000 +0100
2+++ libgcrypt-1.6.0/random/rndlinux.c 2013-12-22 08:41:51.366559962 +0100
37929a93
JB
3@@ -32,6 +32,7 @@
4 #include <string.h>
5 #include <unistd.h>
6 #include <fcntl.h>
7+#include <poll.h>
8 #include "types.h"
9 #include "g10lib.h"
10 #include "rand-internal.h"
c4b9e883 11@@ -179,8 +180,7 @@
37929a93
JB
12 return with something we will actually use 100ms. */
13 while (length)
14 {
15- fd_set rfds;
16- struct timeval tv;
17+ struct pollfd fds;
18 int rc;
19
c4b9e883
JB
20 /* If we collected some bytes update the progress indicator. We
21@@ -195,20 +195,10 @@
22 any_need_entropy = 1;
23 }
24
9f887196
JB
25- /* If the system has no limit on the number of file descriptors
26- and we encounter an fd which is larger than the fd_set size,
27- we don't use the select at all. The select code is only used
28- to emit progress messages. A better solution would be to
29- fall back to poll() if available. */
30-#ifdef FD_SETSIZE
31- if (fd < FD_SETSIZE)
32-#endif
c4b9e883 33- {
9f887196
JB
34- FD_ZERO(&rfds);
35- FD_SET(fd, &rfds);
36- tv.tv_sec = delay;
37- tv.tv_usec = delay? 0 : 100000;
38- if ( !(rc=select(fd+1, &rfds, NULL, NULL, &tv)) )
c4b9e883 39+ {
9f887196
JB
40+ fds.fd = fd;
41+ fds.events = POLLIN;
42+ if ( !(rc=poll(&fds, 1, delay ? (delay*1000) : 100)) )
37929a93 43 {
c4b9e883
JB
44 any_need_entropy = 1;
45 delay = 3; /* Use 3 seconds henceforth. */
46@@ -216,7 +206,7 @@
9f887196
JB
47 }
48 else if( rc == -1 )
49 {
50- log_error ("select() error: %s\n", strerror(errno));
51+ log_error ("poll() error: %s\n", strerror(errno));
52 if (!delay)
53 delay = 1; /* Use 1 second if we encounter an error before
c4b9e883 54 we have ever blocked. */
This page took 0.041706 seconds and 4 git commands to generate.