Yocto Project Discussions
 help / color / mirror / Atom feed
From: Anibal Limon <anibal@limonsoftware.com>
To: yocto@lists.yoctoproject.org
Cc: richard.purdie@linuxfoundation.org, JPEWhacker@gmail.com,
	randy.macleod@windriver.com,
	Anibal Limon <anibal@limonsoftware.com>
Subject: [yocto][ptest-runner 1/2] utils.c: get_available_ptests fix security flags compilation
Date: Sat, 27 Jan 2024 13:23:37 -0600	[thread overview]
Message-ID: <20240127192338.776610-1-anibal@limonsoftware.com> (raw)

When get_available_ptests uses realpath to support symlinks, this is
expected to not fail because usage of stack memory, if fails prints the
error and exit.

Signed-off-by: Anibal Limon <anibal@limonsoftware.com>
---
 utils.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/utils.c b/utils.c
index 59b8b77..54394cc 100644
--- a/utils.c
+++ b/utils.c
@@ -118,7 +118,10 @@ get_available_ptests(const char *dir)
 	int saved_errno = -1; /* Initalize to invalid errno. */
 	char realdir[PATH_MAX];
 
-	realpath(dir, realdir);
+	if (realpath(dir, realdir) == NULL) {
+		fprintf(stderr, "ERROR: get_available_ptests failed to get realpath, %s\n", strerror(errno));
+		exit(1);
+	}
 
 	do
 	{
-- 
2.43.0



             reply	other threads:[~2024-01-27 19:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-27 19:23 Anibal Limon [this message]
2024-01-27 19:23 ` [yocto][ptest-runner 2/2] utils: run_child fix security flags build Anibal Limon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240127192338.776610-1-anibal@limonsoftware.com \
    --to=anibal@limonsoftware.com \
    --cc=JPEWhacker@gmail.com \
    --cc=randy.macleod@windriver.com \
    --cc=richard.purdie@linuxfoundation.org \
    --cc=yocto@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox