diff options
author | Shuah Khan <shuah.kh@samsung.com> | 2014-06-25 12:03:33 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-07-11 21:11:18 -0400 |
commit | ef9feb682dea988f731a2e5a2e8e498aba6a9da7 (patch) | |
tree | f615b86193672f432d1d2ca436fe5d96597941e9 /tools/testing/selftests/mqueue | |
parent | f15fed3da83212da8fa939ec70e38033ea35f8aa (diff) |
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>
Diffstat (limited to 'tools/testing/selftests/mqueue')
-rw-r--r-- | tools/testing/selftests/mqueue/mq_open_tests.c | 20 |
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)) |