Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16461

[PATCH] finfo.c: Fix -Wformat warnings

From Jessica Clarke <jrtc27@jrtc27.com>
Newsgroups gnu.bash.bug
Subject [PATCH] finfo.c: Fix -Wformat warnings
Date 2020-06-27 21:09 +0100
Message-ID <mailman.528.1593295308.2574.bug-bash@gnu.org> (permalink)
References <20200627200925.38810-1-jrtc27@jrtc27.com>

Show all headers | View raw


We must cast these to unsigned long like the surrounding code.
---
 examples/loadables/finfo.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/examples/loadables/finfo.c b/examples/loadables/finfo.c
index 4273aa59..92e98008 100644
--- a/examples/loadables/finfo.c
+++ b/examples/loadables/finfo.c
@@ -334,13 +334,13 @@ int	flags;
 		else
 			printf("%ld\n", st->st_ctime);
 	} else if (flags & OPT_DEV)
-		printf("%d\n", st->st_dev);
+		printf("%lu\n", (unsigned long)st->st_dev);
 	else if (flags & OPT_INO)
 		printf("%lu\n", (unsigned long)st->st_ino);
 	else if (flags & OPT_FID)
-		printf("%d:%lu\n", st->st_dev, (unsigned long)st->st_ino);
+		printf("%lu:%lu\n", (unsigned long)st->st_dev, (unsigned long)st->st_ino);
 	else if (flags & OPT_NLINK)
-		printf("%d\n", st->st_nlink);
+		printf("%lu\n", (unsigned long)st->st_nlink);
 	else if (flags & OPT_LNKNAM) {
 #ifdef S_ISLNK
 		b = xmalloc(4096);
-- 
2.20.1

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

[PATCH] finfo.c: Fix -Wformat warnings Jessica Clarke <jrtc27@jrtc27.com> - 2020-06-27 21:09 +0100

csiph-web