]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
test_uuidd: make pthread_t formatting more robust
authorThomas Weißschuh <thomas@t-8ch.de>
Fri, 19 May 2023 14:47:48 +0000 (16:47 +0200)
committerThomas Weißschuh <thomas@t-8ch.de>
Fri, 19 May 2023 15:48:58 +0000 (17:48 +0200)
On musl pthread_t is a pointer. To avoid compiler warnings on 32bit
systems add a cast through intptr_t.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
misc-utils/test_uuidd.c

index 779b28dfde14613415e715d58a9835306c0bc9e3..f012a2cf7be66dca0a756b6befbe295021ac4e95 100644 (file)
@@ -184,7 +184,7 @@ static void create_nthreads(process_t *proc, size_t index)
                }
 
                LOG(2, (stderr, "%d: started thread [tid=%jd,index=%zu]\n",
-                    proc->pid, (intmax_t) th->tid, th->index));
+                    proc->pid, (intmax_t) (intptr_t) th->tid, th->index));
                index += nobjects;
                ncreated++;
        }
@@ -204,7 +204,7 @@ static void create_nthreads(process_t *proc, size_t index)
                }
 
                LOG(2, (stderr, "%d: thread exited [tid=%jd,return=%d]\n",
-                    proc->pid, (intmax_t) th->tid, th->retval));
+                    proc->pid, (intmax_t) (intptr_t) th->tid, th->retval));
        }
 
        free(threads);
@@ -260,7 +260,7 @@ static void object_dump(size_t idx, object_t *obj)
        fprintf(stderr, "  uuid:    <%s>\n", p);
        fprintf(stderr, "  idx:     %zu\n", obj->idx);
        fprintf(stderr, "  process: %d\n", (int) obj->pid);
-       fprintf(stderr, "  thread:  %jd\n", (intmax_t) obj->tid);
+       fprintf(stderr, "  thread:  %jd\n", (intmax_t) (intptr_t) obj->tid);
        fprintf(stderr, "}\n");
 }