[OpenWrt-Devel,urngd,2/4] Fix wrong types in format strings used in debug build
diff mbox series

Message ID 20191011084204.19790-3-ynezz@true.cz
State Accepted
Delegated to: Petr Štetiar
Headers show
Series
  • sync with upstream, fixes and GitLab CI
Related show

Commit Message

Petr Štetiar Oct. 11, 2019, 8:42 a.m. UTC
GCC 9.2.1 on x86/64 complains about following format string issues:

 urngd.c:94:12: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘size_t’ {aka ‘long unsigned int’} [-Werror=format=]
 urngd.c:94:12: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘size_t’ {aka ‘long unsigned int’} [-Werror=format=]

GCC 7.4.0 on i.mx6 complains about following format string issues:

 urngd.c:55:20: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka unsigned int}' [-Werror=format=]

Ref: https://gitlab.com/ynezz/openwrt-urngd/-/jobs/306404059
Ref: https://gitlab.com/ynezz/openwrt-urngd/-/jobs/309187631
Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
 urngd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/urngd.c b/urngd.c
index 306420a397dc..d8ed159141e0 100644
--- a/urngd.c
+++ b/urngd.c
@@ -91,7 +91,7 @@  static size_t write_entropy(struct urngd *u, char *buf, size_t len,
 	if (0 > ret) {
 		ERROR("error injecting entropy: %s\n", strerror(errno));
 	} else {
-		DEBUG(1, "injected %ub (%ub of entropy)\n", len, entropy_bytes);
+		DEBUG(1, "injected %zub (%zub of entropy)\n", len, entropy_bytes);
 		written = len;
 	}
 
@@ -121,7 +121,7 @@  static size_t gather_entropy(struct urngd *u)
 	}
 
 	memset_secure(buf, 0, sizeof(buf));
-	DEBUG(2, DEV_RANDOM " fed with %lub of entropy\n", ret);
+	DEBUG(2, DEV_RANDOM " fed with %zub of entropy\n", ret);
 
 	return ret;
 }