tests: add casts to avoid -Wformat errors on 32-bit Solaris builds

For historical reasons, pid_t & mode_t are defined as long instead
of int for 32-bit processes in the Solaris headers, and even though
they are the same size, gcc issues -Wformat headers if you try to
print them with "%d" and "%u" instead of "%ld" & "%lu".

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
Alan Coopersmith 2024-10-14 17:54:15 -07:00
parent 5aabd288ad
commit b6004c70cc
2 changed files with 2 additions and 2 deletions

View File

@ -2469,7 +2469,7 @@ test_copy_preserve_mode (void)
/* Reset the umask after querying it above. Theres no way to query it without
* changing it. */
umask (current_umask);
g_test_message ("Current umask: %u", current_umask);
g_test_message ("Current umask: %u", (unsigned int) current_umask);
for (i = 0; i < G_N_ELEMENTS (vectors); i++)
{

View File

@ -228,7 +228,7 @@ test_child_private (void)
spawn_flags |= G_SPAWN_DO_NOT_REAP_CHILD;
#endif
g_snprintf (pid, sizeof(pid), "%d", getpid ());
g_snprintf (pid, sizeof (pid), "%d", (int) getpid ());
child_argv[0] = local_argv[0];
child_argv[1] = "mapchild";
child_argv[2] = pid;