Fixes,

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

Signed-off-by: Aníbal Limón <[email protected]>
---
 utils.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/utils.c b/utils.c
index a4e190e..43ab03b 100644
--- a/utils.c
+++ b/utils.c
@@ -34,6 +34,7 @@
 #include <poll.h>
 #include <pty.h>
 #include <signal.h>
+#include <limits.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
@@ -85,6 +86,9 @@ get_available_ptests(const char *dir)
        struct dirent **namelist;
        int fail;
        int saved_errno = -1; /* Initalize to invalid errno. */
+       char realdir[PATH_MAX];
+
+       realpath(dir, realdir);
 
        do
        {
@@ -93,7 +97,7 @@ get_available_ptests(const char *dir)
                if (head == NULL)
                        break;
 
-               if (stat(dir, &st_buf) == -1) {
+               if (stat(realdir, &st_buf) == -1) {
                        PTEST_LIST_FREE_CLEAN(head);
                        break;
                }
@@ -104,7 +108,7 @@ get_available_ptests(const char *dir)
                        break;
                }
 
-               n = scandir(dir, &namelist, NULL, alphasort);
+               n = scandir(realdir, &namelist, NULL, alphasort);
                if (n == -1) {
                        PTEST_LIST_FREE_CLEAN(head);
                        break;
@@ -130,7 +134,7 @@ get_available_ptests(const char *dir)
                        }
 
                        if (asprintf(&run_ptest, "%s/%s/ptest/run-ptest",
-                           dir, d_name) == -1)  {
+                           realdir, d_name) == -1)  {
                                fail = 1;
                                saved_errno = errno;
                                free(d_name);
-- 
2.31.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#52811): https://lists.yoctoproject.org/g/yocto/message/52811
Mute This Topic: https://lists.yoctoproject.org/mt/81542213/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to