aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2013-12-30 10:50:45 -0600
committerPaul Kehrer <paul.l.kehrer@gmail.com>2013-12-30 11:17:09 -0600
commit698f22fb6c83f1d2710dfa2d21960e140fce7380 (patch)
tree432776c17d14b65faf773f3a339a2d84e40fe11d
parente646369697f9de02b904c6492cc523305108a244 (diff)
downloadcryptography-698f22fb6c83f1d2710dfa2d21960e140fce7380.tar.gz
cryptography-698f22fb6c83f1d2710dfa2d21960e140fce7380.tar.bz2
cryptography-698f22fb6c83f1d2710dfa2d21960e140fce7380.zip
fix fd int check, remove stray comedy printf()
-rw-r--r--cryptography/hazmat/backends/openssl/urand_engine.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/cryptography/hazmat/backends/openssl/urand_engine.py b/cryptography/hazmat/backends/openssl/urand_engine.py
index 67ebe272..0004c50c 100644
--- a/cryptography/hazmat/backends/openssl/urand_engine.py
+++ b/cryptography/hazmat/backends/openssl/urand_engine.py
@@ -37,7 +37,7 @@ static const char *Cryptography_urandom_engine_id= "urandom";
static const char *Cryptography_urandom_engine_name = "urandom_engine";
#ifndef _WIN32
-static int urandom_fd;
+static int urandom_fd = -1;
static int urandom_rand_bytes(unsigned char *buffer, int size) {
ssize_t n;
@@ -61,10 +61,9 @@ static int urandom_rand_status(void) {
static int urandom_init(ENGINE *e) {
urandom_fd = open("/dev/urandom", O_RDONLY);
- if (urandom_fd > 0) {
+ if (urandom_fd > -1) {
return 1;
} else {
- printf("crap");
return 0;
}
}