[patch] setfiles bugfix

Denys Vlasenko vda.linux at googlemail.com
Thu Sep 27 04:19:21 PDT 2007


On Thursday 27 September 2007 00:26, Yuichi Nakamura wrote:
> > >                         file_sep = strrchr(tmp_path, '/');
> > >                         if (file_sep == tmp_path) {
> > >                                 file_sep++;
> > > -                               p[0] = '\0';
> > > +                               path[0] = '\0';
> > >                                 p = path;
> > >                         } else if (file_sep) {
> > >                                 *file_sep++ = '\0';
> > >  
> > > 
> > > It should be shorter.
> > I agree, please apply this.
> I was wrong...
> 
> p should also point to path.

It is. There is "p = path;"

> So, this patch does not work.
> Please apply original one, below.

>  				file_sep++;
> -				p[0] = '\0';
> -				p = path;
> +				p = strcpy(path, "");

"store NUL in path[0], then copy path to p".

It is equivalent to:   path[0] = '\0'; p = path;
--
vda


More information about the busybox mailing list