Skip to contentSkip to conversation

Fix format specifier for pointer subtraction

PATCH New Alyssa Ross 1 participant 1 message Mar 1, 2023 Keys/keyrings

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix format specifier for pointer subtraction

Resolves the following compiler error:

keyctl_watch.c: In function 'consumer':
keyctl_watch.c:177:61: error: format '%zx' expects argument of type 'size_t', but argument 3 has type 'int' [-Werror=format=]

  177 |                                 fprintf(stderr, "NOTIFY[%03zx]: ty=%06x sy=%02x i=%08x\n",
      |                                                         ~~~~^
      |                                                             |
      |                                                             long unsigned int
      |                                                         %03x
  178 |                                         p - buffer, n.n.type, n.n.subtype, n.n.info);
      |                                         ~~~~~~~~~~
      |                                           |
      |                                           int
---
 keyctl_watch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
keyctl_watch.c +1 -1
index a70a19a..1436c08 100644
@@ -179,7 +179,7 @@ int consumer(FILE *log, FILE *gc, int fd)
 			memcpy(&n, p, largest);
 
 			if (debug)
-				fprintf(stderr, "NOTIFY[%03zx]: ty=%06x sy=%02x i=%08x\n",
+				fprintf(stderr, "NOTIFY[%03tx]: ty=%06x sy=%02x i=%08x\n",
 					p - buffer, n.n.type, n.n.subtype, n.n.info);
 
 			len = n.n.info & WATCH_INFO_LENGTH;
Signature · 1 line
2.37.1