Skip to content

Commit

Permalink
Merge pull request #41 from DrDaveD/fix-el9
Browse files Browse the repository at this point in the history
Allow for multiple read operations, needed on el9
  • Loading branch information
djw8605 authored Aug 29, 2023
2 parents d2fb940 + d74e33d commit d2f6c77
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/x509_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,22 @@ using namespace std; // NOLINT
* Get bytes from stdin.
*/
static void Read(void *buf, size_t nbyte) {
int num_bytes;
int n;
size_t num_bytes = 0;
do {
num_bytes = read(fileno(stdin), buf, nbyte);
} while ((num_bytes < 0) && (errno == EINTR));
n = read(fileno(stdin), (char *)buf + num_bytes, nbyte - num_bytes);
if (n < 0) {
if (errno != EINTR) {
break;
}
}
else if (n == 0) {
break;
}
else {
num_bytes += n;
}
} while (num_bytes < nbyte);
assert(num_bytes >= 0);
assert(static_cast<size_t>(num_bytes) == nbyte);
}
Expand Down

0 comments on commit d2f6c77

Please sign in to comment.