diff options
Diffstat (limited to 'lib/libc/unistd')
| -rw-r--r-- | lib/libc/unistd/execvp.c | 13 | ||||
| -rw-r--r-- | lib/libc/unistd/getopt.c | 3 | ||||
| -rw-r--r-- | lib/libc/unistd/readlinkat.c | 3 | ||||
| -rw-r--r-- | lib/libc/unistd/write.c | 1 |
4 files changed, 7 insertions, 13 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; diff --git a/lib/libc/unistd/getopt.c b/lib/libc/unistd/getopt.c index c942da56..4cfca00e 100644 --- a/lib/libc/unistd/getopt.c +++ b/lib/libc/unistd/getopt.c @@ -95,8 +95,7 @@ int getopt(int argc, char *const argv[], const char *optstring) iov[0].iov_base = argv[0]; iov[0].iov_len = strlen(argv[0]); - iov[1].iov_base = - ": option requires an argument -- "; + iov[1].iov_base = ": option requires an argument -- "; iov[1].iov_len = 33; iov[2].iov_base = opt_char; iov[2].iov_len = 1; diff --git a/lib/libc/unistd/readlinkat.c b/lib/libc/unistd/readlinkat.c index b4fbcb39..47161cff 100644 --- a/lib/libc/unistd/readlinkat.c +++ b/lib/libc/unistd/readlinkat.c @@ -4,8 +4,7 @@ #include <syscall.h> // for __syscall_4, syscall #include <unistd.h> // for readlinkat, size_t, ssize_t -ssize_t readlinkat(int fd, const char *restrict path, char *restrict buf, - size_t bufsize) +ssize_t readlinkat(int fd, const char *restrict path, char *restrict buf, size_t bufsize) { return syscall(readlinkat, fd, path, buf, bufsize); } diff --git a/lib/libc/unistd/write.c b/lib/libc/unistd/write.c index 9e8ce260..3be27fa5 100644 --- a/lib/libc/unistd/write.c +++ b/lib/libc/unistd/write.c @@ -1,3 +1,4 @@ +#include <stddef.h> #include <syscall.h> #include <unistd.h> |
