diff mbox series

[ptest-runner,1/2] utils.c: get_available_ptests fix security flags compilation

Message ID 20240127192338.776610-1-anibal@limonsoftware.com
State New
Headers show
Series [ptest-runner,1/2] utils.c: get_available_ptests fix security flags compilation | expand

Commit Message

Anibal Limon Jan. 27, 2024, 7:23 p.m. UTC
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 mbox series

Patch

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
 	{