[LTP] [COMMITTED] [PATCH 1/2] SAFE_MACROS: Add SAFE_EXECLP()

Cyril Hrubis chrubis@suse.cz
Tue Nov 1 10:27:28 CET 2016


Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 include/tst_safe_macros.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/tst_safe_macros.h b/include/tst_safe_macros.h
index 3cf154e..d1519f9 100644
--- a/include/tst_safe_macros.h
+++ b/include/tst_safe_macros.h
@@ -427,4 +427,10 @@ static inline sighandler_t safe_signal(const char *file, const int lineno,
 #define SAFE_SIGNAL(signum, handler) \
 	safe_signal(__FILE__, __LINE__, (signum), (handler))
 
+#define SAFE_EXECLP(file, arg, ...) do {                   \
+	execlp((file), (arg), ##__VA_ARGS__);              \
+	tst_brk_(__FILE__, __LINE__, TBROK | TERRNO,       \
+	         "execlp(%s, %s, ...) failed", file, arg); \
+	} while (0)
+
 #endif /* SAFE_MACROS_H__ */
-- 
2.7.3


-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list