Hi!

On Tue, 2011-03-01 at 17:11:05 -0600, Jonathan Nieder wrote:
> Steve Langasek wrote:
> > --- a/src/help.c
> > +++ b/src/help.c
> > @@ -186,6 +186,11 @@ preexecscript(struct command *cmd)
> >    size_t instdirl;
> >  
> >    if (*instdir) {
> > +    if (strstr(admindir, instdir) == admindir)
> > +      /* Already forked, safe to modify the environment; strip off the 
> > chroot
> > +         path from our admin dir so this works under the chroot */
> > +      if (setenv("DPKG_ADMINDIR", admindir+strlen(instdir), 1) < 0)
> > +        ohshite(_("unable to setenv for subprocesses"));
> 
> strstr can be slow. :)  Why not:
> 
>       size_t instdirlen = strlen(instdir);
>       if (strncmp(admindir, instdir, instdirlen) == 0) {
>         /* ... explanatory comment ... */
>         if (setenv("DPKG_ADMINDIR", admindir + instdirlen, 1) < 0)
>           ohshite(_(...));
>       }

I've done some rearrangments and queued it for my next push, in few
minutes.

thanks,
guillem


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: http://lists.debian.org/[email protected]

Reply via email to