forked from hyperledger-iroha/iroha-dco
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix consensus sunny day test (hyperledger-iroha#1310)
* Fix wakeup in consensus sunny day test * Fix file descriptors not being closed in iroha-ed25519 randombytes Signed-off-by: Andrei Lebedev <[email protected]>
- Loading branch information
Showing
3 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
diff --git a/lib/randombytes/random/random.c b/lib/randombytes/random/random.c | ||
index e5eca79..e6e862e 100644 | ||
--- a/lib/randombytes/random/random.c | ||
+++ b/lib/randombytes/random/random.c | ||
@@ -13,6 +13,7 @@ int randombytes(unsigned char *p, int len) { | ||
while (completed < len) { | ||
ssize_t result = read(source, p + completed, len - completed); | ||
if (result < 0) { | ||
+ close(source); | ||
return ED25519_ERROR; | ||
} | ||
completed += result; | ||
diff --git a/lib/randombytes/urandom/urandom.c b/lib/randombytes/urandom/urandom.c | ||
index ecad2cf..5b4ec0d 100644 | ||
--- a/lib/randombytes/urandom/urandom.c | ||
+++ b/lib/randombytes/urandom/urandom.c | ||
@@ -9,9 +9,12 @@ int randombytes(unsigned char *p, int len) { | ||
} else { | ||
ssize_t result = read(source, p, len); | ||
if (result < 0) { | ||
+ close(source); | ||
return ED25519_ERROR; /* something went wrong */ | ||
} | ||
} | ||
|
||
+ close(source); | ||
+ | ||
return ED25519_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters