Skip to contentSkip to conversation

tst_safe_macros: Add SAFE_EXECVP()

PATCH New Petr Vorel 1 participant 1 message Mar 29, 2021

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/1 tst_safe_macros: Add SAFE_EXECVP()

---
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/[email protected]/

 include/tst_safe_macros.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/tst_safe_macros.h +6 -0
index 2a2b0088a..b9d9baa1a 100644
@@ -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))
Signature · 1 line
2.30.2