aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/mqueue/mq_open_tests.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/tools/testing/selftests/mqueue/mq_open_tests.c b/tools/testing/selftests/mqueue/mq_open_tests.c
index 711cc2923047..9c1a5d359055 100644
--- a/tools/testing/selftests/mqueue/mq_open_tests.c
+++ b/tools/testing/selftests/mqueue/mq_open_tests.c
@@ -80,7 +80,8 @@ void shutdown(int exit_val, char *err_cause, int line_no)
80 if (in_shutdown++) 80 if (in_shutdown++)
81 return; 81 return;
82 82
83 seteuid(0); 83 if (seteuid(0) == -1)
84 perror("seteuid() failed");
84 85
85 if (queue != -1) 86 if (queue != -1)
86 if (mq_close(queue)) 87 if (mq_close(queue))
@@ -292,8 +293,10 @@ int main(int argc, char *argv[])
292 /* Tell the user our initial state */ 293 /* Tell the user our initial state */
293 printf("\nInitial system state:\n"); 294 printf("\nInitial system state:\n");
294 printf("\tUsing queue path:\t\t%s\n", queue_path); 295 printf("\tUsing queue path:\t\t%s\n", queue_path);
295 printf("\tRLIMIT_MSGQUEUE(soft):\t\t%d\n", saved_limits.rlim_cur); 296 printf("\tRLIMIT_MSGQUEUE(soft):\t\t%ld\n",
296 printf("\tRLIMIT_MSGQUEUE(hard):\t\t%d\n", saved_limits.rlim_max); 297 (long) saved_limits.rlim_cur);
298 printf("\tRLIMIT_MSGQUEUE(hard):\t\t%ld\n",
299 (long) saved_limits.rlim_max);
297 printf("\tMaximum Message Size:\t\t%d\n", saved_max_msgsize); 300 printf("\tMaximum Message Size:\t\t%d\n", saved_max_msgsize);
298 printf("\tMaximum Queue Size:\t\t%d\n", saved_max_msgs); 301 printf("\tMaximum Queue Size:\t\t%d\n", saved_max_msgs);
299 if (default_settings) { 302 if (default_settings) {
@@ -308,8 +311,8 @@ int main(int argc, char *argv[])
308 validate_current_settings(); 311 validate_current_settings();
309 312
310 printf("Adjusted system state for testing:\n"); 313 printf("Adjusted system state for testing:\n");
311 printf("\tRLIMIT_MSGQUEUE(soft):\t\t%d\n", cur_limits.rlim_cur); 314 printf("\tRLIMIT_MSGQUEUE(soft):\t\t%ld\n", (long) cur_limits.rlim_cur);
312 printf("\tRLIMIT_MSGQUEUE(hard):\t\t%d\n", cur_limits.rlim_max); 315 printf("\tRLIMIT_MSGQUEUE(hard):\t\t%ld\n", (long) cur_limits.rlim_max);
313 printf("\tMaximum Message Size:\t\t%d\n", cur_max_msgsize); 316 printf("\tMaximum Message Size:\t\t%d\n", cur_max_msgsize);
314 printf("\tMaximum Queue Size:\t\t%d\n", cur_max_msgs); 317 printf("\tMaximum Queue Size:\t\t%d\n", cur_max_msgs);
315 if (default_settings) { 318 if (default_settings) {
@@ -454,7 +457,12 @@ int main(int argc, char *argv[])
454 else 457 else
455 printf("Queue open with total size > 2GB when euid = 0 " 458 printf("Queue open with total size > 2GB when euid = 0 "
456 "failed:\t\t\tPASS\n"); 459 "failed:\t\t\tPASS\n");
457 seteuid(99); 460
461 if (seteuid(99) == -1) {
462 perror("seteuid() failed");
463 exit(1);
464 }
465
458 attr.mq_maxmsg = cur_max_msgs; 466 attr.mq_maxmsg = cur_max_msgs;
459 attr.mq_msgsize = cur_max_msgsize; 467 attr.mq_msgsize = cur_max_msgsize;
460 if (test_queue_fail(&attr, &result)) 468 if (test_queue_fail(&attr, &result))