[LTP] [PATCH 18/19] Unify error handling in lib/tst_resource.c

Martin Doucha mdoucha@suse.cz
Mon Oct 26 17:47:55 CET 2020


- Properly format caller file:line location

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 lib/tst_resource.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/lib/tst_resource.c b/lib/tst_resource.c
index 0b9b381f1..c35d05a25 100644
--- a/lib/tst_resource.c
+++ b/lib/tst_resource.c
@@ -102,9 +102,8 @@ void tst_resource_copy(const char *file, const int lineno,
 		       const char *filename, const char *dest)
 {
 	if (!tst_tmpdir_created()) {
-		tst_brkm(TBROK, cleanup_fn,
-		         "Temporary directory doesn't exist at %s:%d",
-		         file, lineno);
+		tst_brkm_(file, lineno, TBROK, cleanup_fn,
+			"Temporary directory doesn't exist");
 		return;
 	}
 
@@ -133,6 +132,6 @@ void tst_resource_copy(const char *file, const int lineno,
 	if (file_copy(file, lineno, cleanup_fn, startwd, filename, dest))
 		return;
 
-	tst_brkm(TBROK, cleanup_fn, "Failed to copy resource '%s' at %s:%d",
-	         filename, file, lineno);
+	tst_brkm_(file, lineno, TBROK, cleanup_fn,
+		"Failed to copy resource '%s'", filename);
 }
-- 
2.28.0



More information about the ltp mailing list