]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Don't close the random device on EINTR
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 29 May 2019 14:05:25 +0000 (16:05 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 29 May 2019 14:40:49 +0000 (16:40 +0200)
pdns/dns_random.cc

index e2b8e45754973300f34c90b887a8dab6b2af0d1f..48b910c8f4f85d7c2a561f664de3c52fc37dd922 100644 (file)
@@ -285,6 +285,10 @@ uint32_t dns_random(uint32_t upper_bound) {
       do {
         ssize_t got = read(urandom_fd, &num, sizeof(num));
         if (got < 0) {
+          if (errno == EINTR) {
+            continue;
+          }
+
           (void)close(urandom_fd);
           throw std::runtime_error("Cannot read random device");
         }