mirror of
https://github.com/rfc1036/whois.git
synced 2026-05-03 06:51:09 +00:00
Remove unused variables in get_random_bytes()
If getentropy() is available, GCC warns about unsused variables:
mkpasswd.c: In function ‘get_random_bytes’:
mkpasswd.c:369:13: warning: unused variable ‘bytes_read’ [-Wunused-variable]
ssize_t bytes_read;
^~~~~~~~~~
mkpasswd.c:368:9: warning: unused variable ‘fd’ [-Wunused-variable]
int fd;
^~
This patch fixes it.
This commit is contained in:
parent
888fa4654b
commit
50b57a6fb7
@ -364,17 +364,17 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
void* get_random_bytes(const unsigned int count)
|
void* get_random_bytes(const unsigned int count)
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf = NOFAIL(malloc(count));
|
||||||
int fd;
|
|
||||||
ssize_t bytes_read;
|
|
||||||
|
|
||||||
buf = NOFAIL(malloc(count));
|
|
||||||
#if defined HAVE_ARC4RANDOM_BUF
|
#if defined HAVE_ARC4RANDOM_BUF
|
||||||
arc4random_buf(buf, count);
|
arc4random_buf(buf, count);
|
||||||
#elif defined HAVE_GETENTROPY
|
#elif defined HAVE_GETENTROPY
|
||||||
if (getentropy(buf, count) < 0)
|
if (getentropy(buf, count) < 0)
|
||||||
perror("getentropy");
|
perror("getentropy");
|
||||||
#else
|
#else
|
||||||
|
int fd;
|
||||||
|
ssize_t bytes_read;
|
||||||
|
|
||||||
fd = open(RANDOM_DEVICE, O_RDONLY);
|
fd = open(RANDOM_DEVICE, O_RDONLY);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
perror("open(" RANDOM_DEVICE ")");
|
perror("open(" RANDOM_DEVICE ")");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user