summaryrefslogtreecommitdiff
path: root/plugins/MirOTR/libgcrypt-1.4.6/random/rndlinux.c
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-02 20:55:18 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-02 20:55:18 +0000
commit78c0815c4118fe24ab78cce2dc48a6232dcd824a (patch)
tree8512c50df70b8dd80c919e88ade3419207c95956 /plugins/MirOTR/libgcrypt-1.4.6/random/rndlinux.c
parentce816d83a8c75808e0eb06832592bffefe4a8dc4 (diff)
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirOTR/libgcrypt-1.4.6/random/rndlinux.c')
-rw-r--r--plugins/MirOTR/libgcrypt-1.4.6/random/rndlinux.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/plugins/MirOTR/libgcrypt-1.4.6/random/rndlinux.c b/plugins/MirOTR/libgcrypt-1.4.6/random/rndlinux.c
index 574ef6dcc0..aca72011ea 100644
--- a/plugins/MirOTR/libgcrypt-1.4.6/random/rndlinux.c
+++ b/plugins/MirOTR/libgcrypt-1.4.6/random/rndlinux.c
@@ -74,9 +74,9 @@ open_device ( const char *name )
struct stat sb;
- if( fstat( fd, &sb ) )
+ if ( fstat( fd, &sb ) )
log_fatal("stat() off %s failed: %s\n", name, strerror(errno) );
- if( (!S_ISCHR(sb.st_mode)) && (!S_ISFIFO(sb.st_mode)) )
+ if ( (!S_ISCHR(sb.st_mode)) && (!S_ISFIFO(sb.st_mode)) )
log_fatal("invalid random device!\n" );
*/
return fd;
@@ -108,13 +108,13 @@ _gcry_rndlinux_gather_random (void (*add)(const void*, size_t,
/* Open the requested device. */
if (level >= 2)
{
- if( fd_random == -1 )
+ if ( fd_random == -1 )
fd_random = open_device ( NAME_OF_DEV_RANDOM );
fd = fd_random;
}
else
{
- if( fd_urandom == -1 )
+ if ( fd_urandom == -1 )
fd_urandom = open_device ( NAME_OF_DEV_URANDOM );
fd = fd_urandom;
}
@@ -130,16 +130,16 @@ _gcry_rndlinux_gather_random (void (*add)(const void*, size_t,
FD_SET(fd, &rfds);
tv.tv_sec = 3;
tv.tv_usec = 0;
- if( !(rc=select(fd+1, &rfds, NULL, NULL, &tv)) )
+ if ( !(rc=select(fd+1, &rfds, NULL, NULL, &tv)) )
{
- if( !warn )
+ if ( !warn )
{
_gcry_random_progress ("need_entropy", 'X', 0, (int)length);
warn = 1;
}
continue;
}
- else if( rc == -1 )
+ else if ( rc == -1 )
{
log_error ("select() error: %s\n", strerror(errno));
continue;
@@ -149,14 +149,14 @@ _gcry_rndlinux_gather_random (void (*add)(const void*, size_t,
{
int nbytes = length < sizeof(buffer)? length : sizeof(buffer);
n = read(fd, buffer, nbytes );
- if( n >= 0 && n > nbytes )
+ if ( n >= 0 && n > nbytes )
{
log_error("bogus read from random device (n=%d)\n", n );
n = nbytes;
}
}
while( n == -1 && errno == EINTR );
- if( n == -1 )
+ if ( n == -1 )
log_fatal("read error on random device: %s\n", strerror(errno));
(*add)( buffer, n, origin );
length -= n;