[LTP] [PATCH v2 1/5] lib: tst_cmd: Make tst_cmd() usable for global paths
Cyril Hrubis
chrubis@suse.cz
Wed Feb 24 17:50:41 CET 2021
We need to skip the check if the path to the binary starts with '/'.
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
lib/tst_cmd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/tst_cmd.c b/lib/tst_cmd.c
index 7446249f9..b73978e20 100644
--- a/lib/tst_cmd.c
+++ b/lib/tst_cmd.c
@@ -58,7 +58,7 @@ int tst_cmd_fds_(void (cleanup_fn)(void),
char path[PATH_MAX];
- if (tst_get_path(argv[0], path, sizeof(path))) {
+ if (argv[0][0] != '/' && tst_get_path(argv[0], path, sizeof(path))) {
if (flags & TST_CMD_TCONF_ON_MISSING)
tst_brkm(TCONF, cleanup_fn, "Couldn't find '%s' in $PATH at %s:%d", argv[0],
__FILE__, __LINE__);
--
2.26.2
More information about the ltp
mailing list