[LTP] [PATCH 1/1] tst_safe_macros: Add SAFE_EXECVP()

Petr Vorel pvorel@suse.cz
Mon Mar 29 19:41:35 CEST 2021


Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Fix for Joerg's patch [1], deliberatelly using execvp() instead of
execv() (more info at that patch).

Kind regards,
Petr

[1] https://patchwork.ozlabs.org/project/ltp/patch/20210315092844.991073-1-lkml@jv-coder.de/

 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 2a2b0088a..b9d9baa1a 100644
--- a/include/tst_safe_macros.h
+++ b/include/tst_safe_macros.h
@@ -487,6 +487,12 @@ int safe_sigwait(const char *file, const int lineno,
                 "execl(%s, %s, ...) failed", file, arg); 	\
        } while (0)
 
+#define SAFE_EXECVP(file, arg) do {                   \
+	execvp((file), (arg));              \
+	tst_brk_(__FILE__, __LINE__, TBROK | TERRNO,       \
+	         "execvp(%s, %p) failed", file, arg); \
+	} while (0)
+
 int safe_getpriority(const char *file, const int lineno, int which, id_t who);
 #define SAFE_GETPRIORITY(which, who) \
 	safe_getpriority(__FILE__, __LINE__, (which), (who))
-- 
2.30.2



More information about the ltp mailing list