summaryrefslogtreecommitdiff
path: root/lib/libc/unistd/execvp.c
diff options
context:
space:
mode:
authorKacper <kacper@mail.openlinux.dev>2025-12-25 19:24:38 +0100
committerKacper <kacper@mail.openlinux.dev>2025-12-25 20:35:03 +0100
commita984eb367c032dbe2577f01238c3d1268526be70 (patch)
tree437fef40379b2758b129ccea39df3570fa2d145e /lib/libc/unistd/execvp.c
parent8834571b202cf4dc9c649cfb096c213b6ecf1566 (diff)
Clang-tidy fixes
Diffstat (limited to 'lib/libc/unistd/execvp.c')
-rw-r--r--lib/libc/unistd/execvp.c13
1 files changed, 4 insertions, 9 deletions
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;