summaryrefslogtreecommitdiff
path: root/usr/auth.c
diff options
context:
space:
mode:
authorJim Ramsay <jim_ramsay@dell.com>2011-07-20 09:06:46 -0400
committerMike Christie <michaelc@cs.wisc.edu>2011-08-02 00:04:23 -0500
commit1e3d6226e928c0ea2c857de9ab821b550ef0e18b (patch)
tree86b470df355c63673f4479d5b2a0918af938bbec /usr/auth.c
parent4c93bba5ea9610fce9999ff7dc21f28b90e947d8 (diff)
downloadopen-iscsi-1e3d6226e928c0ea2c857de9ab821b550ef0e18b.tar.gz
iscsi tools: Fix warnings reported by gcc-4.5.2
A majority of these have to deal with ignored return values. Some of the others are just unused variables or functions. One warning remains at link-time for iscsistart: iscsi_util.c:267: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking. Signed-off-by: Jim Ramsay <jim_ramsay@dell.com>
Diffstat (limited to 'usr/auth.c')
-rw-r--r--usr/auth.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/usr/auth.c b/usr/auth.c
index cc232a0..c924545 100644
--- a/usr/auth.c
+++ b/usr/auth.c
@@ -194,27 +194,20 @@ get_random_bytes(unsigned char *data, unsigned int length)
fd = open("/dev/urandom", O_RDONLY);
while (length > 0) {
- if (fd)
- read(fd, &r, sizeof(long));
- else
+ if (!fd || read(fd, &r, sizeof(long)) != -1)
r = rand();
r = r ^ (r >> 8);
r = r ^ (r >> 4);
n = r & 0x7;
- if (fd)
- read(fd, &r, sizeof(long));
- else
+ if (!fd || read(fd, &r, sizeof(long)) != -1)
r = rand();
r = r ^ (r >> 8);
r = r ^ (r >> 5);
n = (n << 3) | (r & 0x7);
- if (fd)
- read(fd, &r, sizeof(long));
- else
+ if (!fd || read(fd, &r, sizeof(long)) != -1)
r = rand();
-
r = r ^ (r >> 8);
r = r ^ (r >> 5);
n = (n << 2) | (r & 0x3);