[yocto] [PATCH][ptest-runner 1/2] main.c: Use realpath to get the actual directory of ptests

Aníbal Limón anibal.limon at linaro.org
Wed Apr 25 10:19:04 PDT 2018


Fix usage of relative paths in -d argument.

$ ./ptest-runner -d ./tests/data

Signed-off-by: Aníbal Limón <anibal.limon at linaro.org>
---
 main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/main.c b/main.c
index 505829c..593aff1 100644
--- a/main.c
+++ b/main.c
@@ -19,6 +19,7 @@
  * 	Aníbal Limón <anibal.limon at intel.com>
  */
 
+#include <limits.h>
 #include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
@@ -70,7 +71,7 @@ main(int argc, char *argv[])
 		switch (opt) {
 			case 'd':
 				free(opts.directory);
-				opts.directory = strdup(optarg);
+				opts.directory = realpath(optarg, NULL);
 				CHECK_ALLOCATION(opts.directory, 1, 1);
 			break;
 			case 'l':
-- 
2.11.0




More information about the yocto mailing list