On Wed, Jul 12, 2017 at 09:38:34AM -0700, Stephen Hemminger wrote:
> On Mon, 10 Jul 2017 13:19:12 +0200
> Phil Sutter <p...@nwl.cc> wrote:
> 
> > +static bool is_basename(const char *name)
> > +{
> > +   char *name_dup = strdup(name);
> > +   bool rc = true;
> > +
> > +   if (!name_dup)
> > +           return false;
> > +
> > +   if (strcmp(basename(name_dup), name))
> > +           rc = false;
> > +
> > +   free(name_dup);
> > +   return rc;
> > +}
> 
> Looks like natural place to use strdupa.
> 
> static bool is_basename(const char *name)
> {
>       return strcmp(basename(strdupa(name), name) == 0;
> }

Good point! Anyway, my patch fails to cover 'ip netns del' command
(apart from the '..' issue), so I'd suggest to instead apply Matteo's
version (Message-ID 20170710120831.9355-1-mcr...@redhat.com).

Thanks, Phil

Reply via email to