Skip to content

Commit

Permalink
selftests: net: af_unix: Fix incorrect args in test result msg
Browse files Browse the repository at this point in the history
Fix the args to fprintf(). Splitting the message ends up passing
incorrect arg for "sigurg %d" and an extra arg overall. The test
result message ends up incorrect.

test_unix_oob.c: In function ‘main’:
test_unix_oob.c:274:43: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘char *’ [-Wformat=]
  274 |   fprintf(stderr, "Test 3 failed, sigurg %d len %d OOB %c ",
      |                                          ~^
      |                                           |
      |                                           int
      |                                          %s
  275 |   "atmark %d\n", signal_recvd, len, oob, atmark);
      |   ~~~~~~~~~~~~~
      |   |
      |   char *
test_unix_oob.c:274:19: warning: too many arguments for format [-Wformat-extra-args]
  274 |   fprintf(stderr, "Test 3 failed, sigurg %d len %d OOB %c ",

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Shuah Khan authored and David S. Miller committed Sep 19, 2021
1 parent 029497e commit 48514a2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/testing/selftests/net/af_unix/test_unix_oob.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,9 @@ main(int argc, char **argv)
read_oob(pfd, &oob);

if (!signal_recvd || len != 127 || oob != '%' || atmark != 1) {
fprintf(stderr, "Test 3 failed, sigurg %d len %d OOB %c ",
"atmark %d\n", signal_recvd, len, oob, atmark);
fprintf(stderr,
"Test 3 failed, sigurg %d len %d OOB %c atmark %d\n",
signal_recvd, len, oob, atmark);
die(1);
}

Expand Down

0 comments on commit 48514a2

Please sign in to comment.