nareshkamboju

LTP faccessat and fchmodat: Fix build warnings

Jun 20th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.78 KB | None | 0 0
  1. From 88c8d12ab6fb5a3a2962d756b1d9c0877471067e Mon Sep 17 00:00:00 2001
  2. From: Naresh Kamboju <naresh.kamboju@linaro.org>
  3. Date: Mon, 19 Jun 2017 18:03:05 +0530
  4. Subject: [PATCH] faccessat and fchmodat: Fix build warnings
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8.  
  9. Fixing below build warnings.
  10.  
  11. ltp-full-20170516/testcases/kernel/syscalls/faccessat$ make
  12. In file included from ../../../../include/old/test.h:51:0,
  13.                  from faccessat01.c:44:
  14. faccessat01.c: In function ‘setup’:
  15. ../../../../include/old/old_safe_file_ops.h:55:27:
  16. warning: format not a string literal and no format arguments [-Wformat-security]
  17.                    (path), (fmt), ## __VA_ARGS__)
  18.                            ^
  19. faccessat01.c:132:2: note: in expansion of macro ‘SAFE_FILE_PRINTF’
  20.   SAFE_FILE_PRINTF(cleanup, testfile, testfile);
  21.   ^
  22. ../../../../include/old/old_safe_file_ops.h:55:27:
  23. warning: format not a string literal and no format arguments [-Wformat-security]
  24.                    (path), (fmt), ## __VA_ARGS__)
  25.                            ^
  26. faccessat01.c:133:2: note: in expansion of macro ‘SAFE_FILE_PRINTF’
  27.   SAFE_FILE_PRINTF(cleanup, testfile2, testfile2);
  28.  
  29. Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>
  30. ---
  31.  testcases/kernel/syscalls/faccessat/faccessat01.c | 4 ++--
  32.  testcases/kernel/syscalls/fchmodat/fchmodat01.c   | 4 ++--
  33.  2 files changed, 4 insertions(+), 4 deletions(-)
  34.  
  35. diff --git a/testcases/kernel/syscalls/faccessat/faccessat01.c b/testcases/kernel/syscalls/faccessat/faccessat01.c
  36. index 622dfd3..def7fa7 100644
  37. --- a/testcases/kernel/syscalls/faccessat/faccessat01.c
  38. +++ b/testcases/kernel/syscalls/faccessat/faccessat01.c
  39. @@ -129,8 +129,8 @@ void setup(void)
  40.     fds[0] = SAFE_OPEN(cleanup, pathname, O_DIRECTORY);
  41.     fds[1] = fds[4] = fds[0];
  42.  
  43. -   SAFE_FILE_PRINTF(cleanup, testfile, testfile);
  44. -   SAFE_FILE_PRINTF(cleanup, testfile2, testfile2);
  45. +   SAFE_FILE_PRINTF(cleanup, testfile, "%s", testfile);
  46. +   SAFE_FILE_PRINTF(cleanup, testfile2, "%s", testfile2);
  47.  
  48.     fds[2] = SAFE_OPEN(cleanup, testfile3, O_CREAT | O_RDWR, 0600);
  49.  
  50. diff --git a/testcases/kernel/syscalls/fchmodat/fchmodat01.c b/testcases/kernel/syscalls/fchmodat/fchmodat01.c
  51. index 6bf66d8..7856ed3 100644
  52. --- a/testcases/kernel/syscalls/fchmodat/fchmodat01.c
  53. +++ b/testcases/kernel/syscalls/fchmodat/fchmodat01.c
  54. @@ -127,8 +127,8 @@ void setup(void)
  55.     fds[0] = SAFE_OPEN(cleanup, pathname, O_DIRECTORY);
  56.     fds[1] = fds[4] = fds[0];
  57.  
  58. -   SAFE_FILE_PRINTF(cleanup, testfile, testfile);
  59. -   SAFE_FILE_PRINTF(cleanup, testfile2, testfile2);
  60. +   SAFE_FILE_PRINTF(cleanup, testfile, "%s", testfile);
  61. +   SAFE_FILE_PRINTF(cleanup, testfile2, "%s", testfile2);
  62.  
  63.     fds[2] = SAFE_OPEN(cleanup, testfile3, O_CREAT | O_RDWR, 0600);
  64.     fds[3] = 100;
  65. --
  66. 2.7.4
Add Comment
Please, Sign In to add comment