Mark Kettenis wrote: > > Date: Fri, 5 Feb 2016 13:06:56 -0500 > > From: Michael McConville <mm...@mykolab.com> > > > > Michael McConville wrote: > > > Michael McConville wrote: > > > > Maxim Pugachev wrote: > > > > > In a case when the shell name is not specified (i.e. just "#!" without > > > > > a path), don't run the heavy logic that checks shell, simply return > > > > > ENOENT. > > > > > > > > I'm not sure whether this is a reasonable thing to do. Someone with more > > > > kernel API experience will have to comment. > > > > > > > > > Also, as a tiny improvement: avoid a loop when calculating shell's > > > > > args length. > > > > > > > > It seems like there's a simpler solution to this: strlen. Also, the > > > > assignment that follows the for loop seems dead, as we know *cp will be > > > > NUL. > > > > > > > > The below diff makes that change, removes the useless if condition you > > > > noticed, and bumps a few variable initializations into the declaration > > > > block. > > > > > > I just remembered that this was probably a perfomance concern as well. > > > In that case, we could assign shellarg and shellarglen earlier in the > > > function, right? > > > > Is anyone willing to work with me on this? This cleanup should obviously > > be done very carefully, but I think it's worth doing because this code > > is... unfortunate. I'd be happy to submit and review in smaller chunks. > > What bug is this fixing? I'm really not interested in diffs that are > basically just churn.
No bug. It just seems unfortunate to have code like this in sys/kern. Dead ops, manually inlined strlen() calls, etc. Not a big deal, though. I'll drop it.