summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2019-03-26 09:36:47 +0000
committerRich Felker <dalias@aerifal.cx>2019-04-02 10:40:01 -0400
commit7fe51ea85b56e3b900f58091e71420ea668c492c (patch)
tree79af9f3777717f4bf2818ac617979d5e03ffbd12
parent086a12b920eedc1779b83a5dfddc00460a4d6be7 (diff)
downloadmusl-7fe51ea85b56e3b900f58091e71420ea668c492c.tar.gz
use __strchrnul instead of strchr and strlen in execvpe
The result is the same but takes less code. Note that __execvpe calls getenv which calls __strchrnul so even using static output the size of the executable won't grow.
-rw-r--r--src/process/execvp.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/process/execvp.c b/src/process/execvp.c
index 1fdf036f..ef3b9dd5 100644
--- a/src/process/execvp.c
+++ b/src/process/execvp.c
@@ -28,8 +28,7 @@ int __execvpe(const char *file, char *const argv[], char *const envp[])
for(p=path; ; p=z) {
char b[l+k+1];
- z = strchr(p, ':');
- if (!z) z = p+strlen(p);
+ z = __strchrnul(p, ':');
if (z-p >= l) {
if (!*z++) break;
continue;