diff options
author | Neil Conway <neilc@samurai.com> | 2005-03-21 05:19:55 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2005-03-21 05:19:55 +0000 |
commit | b160d6b9dcab2954cf4b500c73dd0998aa371f49 (patch) | |
tree | 12486a14bf0ed96d5a4f8982cc14766ade535e05 /contrib/pgcrypto/random.c | |
parent | fa332a06ecffaa027a0b09cdd1907a03d4318911 (diff) | |
download | postgresql-b160d6b9dcab2954cf4b500c73dd0998aa371f49.tar.gz postgresql-b160d6b9dcab2954cf4b500c73dd0998aa371f49.zip |
pgcrypto update:
* Use error codes instead of -1
* px_strerror for new error codes
* calling convention change for px_gen_salt - return error code
* use px_strerror in pgcrypto.c
Marko Kreen
Diffstat (limited to 'contrib/pgcrypto/random.c')
-rw-r--r-- | contrib/pgcrypto/random.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/pgcrypto/random.c b/contrib/pgcrypto/random.c index 17c929c75bb..840d4df7fc4 100644 --- a/contrib/pgcrypto/random.c +++ b/contrib/pgcrypto/random.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/random.c,v 1.8 2004/11/23 23:44:08 neilc Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/random.c,v 1.9 2005/03/21 05:19:55 neilc Exp $ */ @@ -55,7 +55,7 @@ safe_read(int fd, void *buf, size_t count) { if (errno == EINTR) continue; - return -1; + return PXE_DEV_READ_ERROR; } p += res; done += res; @@ -72,7 +72,7 @@ px_get_random_bytes(uint8 *dst, unsigned count) fd = open(RAND_DEV, O_RDONLY); if (fd == -1) - return -1; + return PXE_DEV_READ_ERROR; res = safe_read(fd, dst, count); close(fd); return res; @@ -117,10 +117,10 @@ px_get_random_bytes(uint8 *dst, unsigned count) */ res = RAND_bytes(dst, count); - if (res > 0) + if (res == 1) return count; - return -1; + return PXE_OSSL_RAND_ERROR; } #else |