]> granicus.if.org Git - procps-ng/commitdiff
testsuite: shmget returns an int
authorCraig Small <csmall@dropbear.xyz>
Tue, 3 May 2022 09:41:00 +0000 (19:41 +1000)
committerCraig Small <csmall@dropbear.xyz>
Tue, 3 May 2022 09:41:00 +0000 (19:41 +1000)
Stops the compilier (correctly) complaining:

lib/test_shm.c: In function ‘main’:
lib/test_shm.c:65:23: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘int’ [-Wformat=]
   65 |     printf("SHMID: %llx\n", shm_id);
      |                    ~~~^     ~~~~~~
      |                       |     |
      |                       |     int
      |                       long long unsigned int

shm_id is an int which is what shmget() returns.

Strangely pmap has always scanned this in as a llx even though the maps
"inode" column is the same number that shmget() returns.

Signed-off-by: Craig Small <csmall@dropbear.xyz>
lib/test_shm.c

index 7643f7fe332d3ef4b8726e155c0c729e65ecd6c6..49067304f3ceba6c05a51b88c399adfd65a19be2 100644 (file)
@@ -62,7 +62,7 @@ int main(int argc, char *argv[])
         xerr(EXIT_FAILURE, "Unable to shmget()");
     if ( (shm_addr = shmat(shm_id, NULL, SHM_RDONLY)) < 0)
         xerr(EXIT_FAILURE, "Unable to shmat()");
-    printf("SHMID: %llx\n", shm_id);
+    printf("SHMID: %x\n", shm_id);
     sleep(sleep_time);
     return EXIT_SUCCESS;
 }