Skip to content

Commit

Permalink
stress-landlock: use stress_mk_filename to build newpath
Browse files Browse the repository at this point in the history
Use helper function rather than snprintf to make newpath

Signed-off-by: Colin Ian King <[email protected]>
  • Loading branch information
ColinIanKing committed Feb 10, 2025
1 parent a175bdd commit 1c71921
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stress-landlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@ static void stress_landlock_many(
char newpath[PATH_MAX], resolved[PATH_MAX];

if (strcmp(path, "/"))
(void)snprintf(newpath, sizeof(newpath), "%s/%s", path, namelist[i]->d_name);
(void)stress_mk_filename(newpath, sizeof(newpath), path, namelist[i]->d_name);
else
(void)snprintf(newpath, sizeof(newpath), "/%s", namelist[i]->d_name);
(void)stress_mk_filename(newpath, sizeof(newpath), "", namelist[i]->d_name);

if (UNLIKELY(realpath(newpath, resolved) == NULL))
goto next;
Expand Down

0 comments on commit 1c71921

Please sign in to comment.