Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools: fix mq_open_tests compile warnings

Fix several compile warnings - these are repeats like the ones
below:

gcc -O2 -lrt mq_open_tests.c -o mq_open_tests
mq_open_tests.c: In function ‘main’:
mq_open_tests.c:295:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘rlim_t’ [-Wformat=]
printf("\tRLIMIT_MSGQUEUE(soft):\t\t%d\n", saved_limits.rlim_cur);
^
mq_open_tests.c: In function ‘shutdown’:
mq_open_tests.c:83:9: warning: ignoring return value of ‘seteuid’, declared with attribute warn_unused_result [-Wunused-result]
seteuid(0);

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Shuah Khan and committed by
Greg Kroah-Hartman
ef9feb68 f15fed3d

+14 -6
+14 -6
tools/testing/selftests/mqueue/mq_open_tests.c
··· 80 80 if (in_shutdown++) 81 81 return; 82 82 83 - seteuid(0); 83 + if (seteuid(0) == -1) 84 + perror("seteuid() failed"); 84 85 85 86 if (queue != -1) 86 87 if (mq_close(queue)) ··· 293 292 /* Tell the user our initial state */ 294 293 printf("\nInitial system state:\n"); 295 294 printf("\tUsing queue path:\t\t%s\n", queue_path); 296 - printf("\tRLIMIT_MSGQUEUE(soft):\t\t%d\n", saved_limits.rlim_cur); 297 - printf("\tRLIMIT_MSGQUEUE(hard):\t\t%d\n", saved_limits.rlim_max); 295 + printf("\tRLIMIT_MSGQUEUE(soft):\t\t%ld\n", 296 + (long) saved_limits.rlim_cur); 297 + printf("\tRLIMIT_MSGQUEUE(hard):\t\t%ld\n", 298 + (long) saved_limits.rlim_max); 298 299 printf("\tMaximum Message Size:\t\t%d\n", saved_max_msgsize); 299 300 printf("\tMaximum Queue Size:\t\t%d\n", saved_max_msgs); 300 301 if (default_settings) { ··· 311 308 validate_current_settings(); 312 309 313 310 printf("Adjusted system state for testing:\n"); 314 - printf("\tRLIMIT_MSGQUEUE(soft):\t\t%d\n", cur_limits.rlim_cur); 315 - printf("\tRLIMIT_MSGQUEUE(hard):\t\t%d\n", cur_limits.rlim_max); 311 + printf("\tRLIMIT_MSGQUEUE(soft):\t\t%ld\n", (long) cur_limits.rlim_cur); 312 + printf("\tRLIMIT_MSGQUEUE(hard):\t\t%ld\n", (long) cur_limits.rlim_max); 316 313 printf("\tMaximum Message Size:\t\t%d\n", cur_max_msgsize); 317 314 printf("\tMaximum Queue Size:\t\t%d\n", cur_max_msgs); 318 315 if (default_settings) { ··· 457 454 else 458 455 printf("Queue open with total size > 2GB when euid = 0 " 459 456 "failed:\t\t\tPASS\n"); 460 - seteuid(99); 457 + 458 + if (seteuid(99) == -1) { 459 + perror("seteuid() failed"); 460 + exit(1); 461 + } 462 + 461 463 attr.mq_maxmsg = cur_max_msgs; 462 464 attr.mq_msgsize = cur_max_msgsize; 463 465 if (test_queue_fail(&attr, &result))