summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenjamin Robin <benjarobin@users.noreply.github.com>2017-07-04 23:42:20 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-07-04 17:42:20 -0400
commit218f46711115669c26389a5bad79e57aa3c37f66 (patch)
treedd6be62a634f5c44cd6d37155137f0498ee215f3 /src
parent1a680ae36734a121c5d1767d35bda9e6a923db6d (diff)
downloadsystemd-218f46711115669c26389a5bad79e57aa3c37f66.tar.gz
basic: Fix build warning in random-util (#6284)
Diffstat (limited to 'src')
-rw-r--r--src/basic/random-util.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/basic/random-util.c b/src/basic/random-util.c
index 490107ef41..589575cf00 100644
--- a/src/basic/random-util.c
+++ b/src/basic/random-util.c
@@ -61,7 +61,7 @@ int acquire_random_bytes(void *p, size_t n, bool high_quality_required) {
r = getrandom(p, n, GRND_NONBLOCK);
if (r > 0) {
have_syscall = true;
- if (r == n)
+ if (r == (int) n)
return 0;
if (!high_quality_required) {
/* Fill in the remaing bytes using pseudorandom values */
@@ -147,11 +147,11 @@ void pseudorandom_bytes(void *p, size_t n) {
rr = (unsigned) rand();
#if RAND_STEP >= 3
- if (q - (uint8_t*) p + 2 < n)
+ if (q - (uint8_t*) p + 2 < (ptrdiff_t) n)
q[2] = rr >> 16;
#endif
#if RAND_STEP >= 2
- if (q - (uint8_t*) p + 1 < n)
+ if (q - (uint8_t*) p + 1 < (ptrdiff_t) n)
q[1] = rr >> 8;
#endif
q[0] = rr;