diff mbox series

[meta-swupdate] notifier: workaround for sscanf format mismatch

Message ID 20240910072726.22331-1-ceggers@arri.de
State New
Delegated to: Stefano Babic
Headers show
Series [meta-swupdate] notifier: workaround for sscanf format mismatch | expand

Commit Message

Christian Eggers Sept. 10, 2024, 7:27 a.m. UTC
ino_t is either 'unsigned long' or 'unsigned long long' (depending on
the platform and the C library version). As the C library doesn't
provide a printf/scanf 'conversion specifier' for ino_t, we shouldn't
pass a pointer of this type to sscanf.

Signed-off-by: Christian Eggers <ceggers@arri.de>
---
Please apply to all branches.

 core/notifier.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/core/notifier.c b/core/notifier.c
index dace990951d1..3a762aa39335 100644
--- a/core/notifier.c
+++ b/core/notifier.c
@@ -537,8 +537,8 @@  void notify_init(void)
 	 */
 	if (sd_booted() && getenv("JOURNAL_STREAM") != NULL) {
 		dev_t device;
-		ino_t inode;
-		if (sscanf(getenv("JOURNAL_STREAM"), "%" SCNu64 ":%lu", &device, &inode) == 2) {
+		unsigned long long inode;
+		if (sscanf(getenv("JOURNAL_STREAM"), "%" SCNu64 ":%llu", &device, &inode) == 2) {
 			struct stat statbuffer;
 			if (fstat(fileno(stderr), &statbuffer) == 0) {
 				if (inode == statbuffer.st_ino && device == statbuffer.st_dev) {