diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2011-06-23 13:51:26 +0000 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2011-06-23 13:51:26 +0000 |
commit | 30c6c1fb9db435122bb8a0a1c5d234538ee1c151 (patch) | |
tree | 4ca6d7a68ea96cfd020e290ca6edb5d9ab224dcf /randpkt.c | |
parent | 7da7f34750fe6f879c05ec2128bf065b2eac7b40 (diff) |
Use ws_open/ws_read to avoid prohibited APIs.
Close file handle after usage.
svn path=/trunk/; revision=37769
Diffstat (limited to 'randpkt.c')
-rw-r--r-- | randpkt.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -49,6 +49,7 @@ #include <string.h> #include <glib.h> #include "wiretap/wtap.h" +#include "wsutil/file_util.h" #ifdef _WIN32 #include <wsutil/unicode-utils.h> @@ -705,7 +706,7 @@ seed(void) * * XXX - Use CryptGenRandom on Windows? */ - fd = open(RANDOM_DEV, O_RDONLY); + fd = ws_open(RANDOM_DEV, O_RDONLY); if (fd == -1) { if (errno != ENOENT) { fprintf(stderr, @@ -716,7 +717,7 @@ seed(void) goto fallback; } - ret = read(fd, &randomness, sizeof randomness); + ret = ws_read(fd, &randomness, sizeof randomness); if (ret == -1) { fprintf(stderr, "randpkt: Could not read from " RANDOM_DEV ": %s\n", @@ -730,6 +731,7 @@ seed(void) exit(2); } srand(randomness); + ws_close(fd); return; fallback: |