@@ -12,7 +12,7 @@ void tst_assert_int(const char *file, const int lineno, const char *path, int va
{
int sys_val;
- SAFE_FILE_SCANF(path, "%d", &sys_val);
+ safe_file_scanf(file, lineno, NULL, path, "%d", &sys_val);
if (val == sys_val) {
tst_res_(file, lineno, TPASS, "%s = %d", path, val);
@@ -26,7 +26,7 @@ void tst_assert_str(const char *file, const int lineno, const char *path, const
{
char sys_val[1024];
- SAFE_FILE_SCANF(path, "%1024s", sys_val);
+ safe_file_scanf(file, lineno, NULL, path, "%1024s", sys_val);
if (!strcmp(val, sys_val)) {
tst_res_(file, lineno, TPASS, "%s = '%s'", path, val);
return;
Use safe_file_scanf instead of SAFE_FILE_SCANF, so we can pass correct file and lineno. ie prctl05.c Before this patch, fail as below: safe_file_ops.c:142: BROK: Failed to open FILE '/proc/self/comm1' for reading at tst_assert.c:29: ENOENT (2) After this patch, fail as below: safe_file_ops.c:142: BROK: Failed to open FILE '/proc/self/comm1' for reading at prctl05.c:63: ENOENT (2) Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com> --- lib/tst_assert.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)