From 432dc1efa71e56e364b07c9cd0d0ba1feffadce1 Mon Sep 17 00:00:00 2001 From: Frank Zago Date: Wed, 4 Feb 2015 15:31:31 -0600 Subject: [PATCH] LU-6081 lib: don't ignore the return of read() The return of read() must be checked on some platform, possibly with a recent version of glibc. Otherwise this gives an "ignoring return value of 'read'" warning, which breaks the build. It happens on Ubuntu 14.04. Use the return of read() to the random entropy to fix the issue. This doesn't do much for the entropy, but it doesn't hurt either. Signed-off-by: frank zago Change-Id: Iee7c1bce818e2f163db8f860acf8be075f5a543e Reviewed-on: http://review.whamcloud.com/13654 Reviewed-by: Patrick Farrell Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Henri Doreau Reviewed-by: James Simmons Reviewed-by: Andreas Dilger --- lustre/utils/liblustreapi_util.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lustre/utils/liblustreapi_util.c b/lustre/utils/liblustreapi_util.c index 329f0e4..efd9d3c 100644 --- a/lustre/utils/liblustreapi_util.c +++ b/lustre/utils/liblustreapi_util.c @@ -67,9 +67,10 @@ static __attribute__ ((constructor)) void liblustreapi_init(void) fd = open("/dev/urandom", O_RDONLY | O_NOFOLLOW); if (fd >= 0) { unsigned int rnumber; + ssize_t ret; - (void)read(fd, &rnumber, sizeof(rnumber)); - seed ^= rnumber; + ret = read(fd, &rnumber, sizeof(rnumber)); + seed ^= rnumber ^ ret; close(fd); } -- 1.8.3.1