On Sun, May 28, 2017 at 05:06:45PM +0200, Julien Ramseier wrote: > > > Le 28 mai 2017 à 04:55, Rich Felker a écrit : > >> > >> I'm confused how this patch differs from just removing the "if (*p)" > >> condition before calling match_in_dir. Does match_in_dir actually work > >> if p points to an empty string? I thought not... > > > > Hmm, just removing the "if (*p)" seems to make it work; it looks like > > match_in_dir covers this case fine. I'd like a second opinion on > > whether this looks okay since I haven't touched this code in years, > > but I suspect it'll turn out to be an okay fix for now... > > > > > The "if (*p)" is needed, otherwise match_in_dir will append an empty > match when p = "". Indeed. How about the attached? I did look at your patch, and although it's probably fine, it does have additional side effects like moving the length check across the slash-skipping. That's part of why I looked for a minimally invasive approach. Rich