diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2009-06-02 11:31:32 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2009-06-02 11:31:32 +0000 |
commit | 7457642b8c4ad409f2cf8f91e083301ea2440af9 (patch) | |
tree | f3c2f65f0671b22da72ea9ff38a13e27ab23ba97 /crypto | |
parent | d1e107702bec1015706a95a7ab3b76825e27b83a (diff) |
PR: 1937
Submitted by: Mark Phalan <Mark.Phalan@Sun.COM>
Reviewed by: steve@openssl.org
Fix misuse of st_mode field in struct stat.
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/rand/randfile.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/rand/randfile.c b/crypto/rand/randfile.c index d108353bbc..e12fe0b90c 100644 --- a/crypto/rand/randfile.c +++ b/crypto/rand/randfile.c @@ -127,8 +127,8 @@ int RAND_load_file(const char *file, long bytes) in=fopen(file,"rb"); #endif if (in == NULL) goto err; -#if defined(S_IFBLK) && defined(S_IFCHR) - if (sb.st_mode & (S_IFBLK | S_IFCHR)) { +#if defined(S_ISBLK) && defined(S_ISCHR) + if (S_ISBLK(sb.st_mode) || S_ISCHR(sb.st_mode)) { /* this file is a device. we don't want read an infinite number * of bytes from a random device, nor do we want to use buffered * I/O because we will waste system entropy. @@ -174,8 +174,8 @@ int RAND_write_file(const char *file) i=stat(file,&sb); if (i != -1) { -#if defined(S_IFBLK) && defined(S_IFCHR) - if (sb.st_mode & (S_IFBLK | S_IFCHR)) { +#if defined(S_ISBLK) && defined(S_ISCHR) + if (S_ISBLK(sb.st_mode) || S_ISCHR(sb.st_mode)) { /* this file is a device. we don't write back to it. * we "succeed" on the assumption this is some sort * of random device. Otherwise attempting to write to |