diff options
author | lloyd <[email protected]> | 2014-11-03 22:16:51 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-11-03 22:16:51 +0000 |
commit | bcd83686c3daed38974d1f9b533c07d35c5a7476 (patch) | |
tree | 3203d6f30423ebf3b7b5b3d4aa2b9ecc9ce5ba5e /src/lib/entropy/egd | |
parent | d623823e7e0d2754343ab498f48976e91180d24f (diff) |
Various small fixes and cleanups, new is_prime util
Diffstat (limited to 'src/lib/entropy/egd')
-rw-r--r-- | src/lib/entropy/egd/es_egd.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/entropy/egd/es_egd.cpp b/src/lib/entropy/egd/es_egd.cpp index c04acb4f3..e61d4ef82 100644 --- a/src/lib/entropy/egd/es_egd.cpp +++ b/src/lib/entropy/egd/es_egd.cpp @@ -43,7 +43,7 @@ int EGD_EntropySource::EGD_Socket::open_socket(const std::string& path) std::memset(&addr, 0, sizeof(addr)); addr.sun_family = PF_LOCAL; - if(sizeof(addr.sun_path) < path.length() + 1) + if(path.length() >= sizeof(addr.sun_path)) throw std::invalid_argument("EGD socket path is too long"); std::strncpy(addr.sun_path, path.c_str(), sizeof(addr.sun_path)); @@ -109,7 +109,7 @@ size_t EGD_EntropySource::EGD_Socket::read(byte outbuf[], size_t length) void EGD_EntropySource::EGD_Socket::close() { - if(m_fd > 0) + if(m_fd >= 0) { ::close(m_fd); m_fd = -1; |