From a984eb367c032dbe2577f01238c3d1268526be70 Mon Sep 17 00:00:00 2001 From: Kacper Date: Thu, 25 Dec 2025 19:24:38 +0100 Subject: Clang-tidy fixes --- lib/libc/unistd/execvp.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'lib/libc/unistd/execvp.c') diff --git a/lib/libc/unistd/execvp.c b/lib/libc/unistd/execvp.c index 26934a76..9865aa1b 100644 --- a/lib/libc/unistd/execvp.c +++ b/lib/libc/unistd/execvp.c @@ -31,31 +31,26 @@ int execvp(const char *file, char *const argv[]) ptr = strchr(path, ':'); if (ptr == NULL) { - if (snprintf(buf, PATH_MAX, "%s/%s", path, - file) >= PATH_MAX) { + if (snprintf(buf, PATH_MAX, "%s/%s", path, file) >= PATH_MAX) { errno = ENAMETOOLONG; return -1; } /* Validate path doesn't contain dangerous * characters */ - if (strstr(buf, "..") == NULL && - strchr(buf, '\0') == buf + strlen(buf)) { + if (strstr(buf, "..") == NULL && strchr(buf, '\0') == buf + strlen(buf)) { execv(buf, argv); } break; } - if (snprintf(buf, PATH_MAX, "%.*s/%s", - (int)(ptr - path), path, - file) >= PATH_MAX) { + if (snprintf(buf, PATH_MAX, "%.*s/%s", (int)(ptr - path), path, file) >= PATH_MAX) { errno = ENAMETOOLONG; return -1; } /* Validate path doesn't contain dangerous characters */ - if (strstr(buf, "..") == NULL && - strchr(buf, '\0') == buf + strlen(buf)) { + if (strstr(buf, "..") == NULL && strchr(buf, '\0') == buf + strlen(buf)) { execv(buf, argv); } path = ptr + 1; -- cgit v1.2.3