From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14044 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH 1/2] use __strchrnul instead of strchr and strlen Date: Tue, 2 Apr 2019 10:40:41 -0400 Message-ID: <20190402144041.GL23599@brightrain.aerifal.cx> References: <20190326093648.5669-1-fziglio@redhat.com> <1508751505.10584787.1554199053330.JavaMail.zimbra@redhat.com> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="202896"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-14060-gllmg-musl=m.gmane.org@lists.openwall.com Tue Apr 02 16:40:57 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1hBKau-000qhT-9K for gllmg-musl@m.gmane.org; Tue, 02 Apr 2019 16:40:56 +0200 Original-Received: (qmail 13708 invoked by uid 550); 2 Apr 2019 14:40:54 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 13687 invoked from network); 2 Apr 2019 14:40:53 -0000 Content-Disposition: inline In-Reply-To: <1508751505.10584787.1554199053330.JavaMail.zimbra@redhat.com> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:14044 Archived-At: On Tue, Apr 02, 2019 at 05:57:33AM -0400, Frediano Ziglio wrote: > ping Thanks for the ping. Applying! Rich > > 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. > > --- > > src/process/execvp.c | 3 +-- > > 1 file changed, 1 insertion(+), 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;