On Fri, May 2, 2014 at 11:19 AM, Ralf Friedl <[email protected]> wrote: > I don't know exactly what you did, but for me it works: > $ git diff > diff --git a/libbb/execable.c b/libbb/execable.c > index 178a00a..41540dc 100644 > --- a/libbb/execable.c > +++ b/libbb/execable.c > @@ -37,6 +37,8 @@ char* FAST_FUNC find_execable(const char *filename, char > **PATHp) > > n = strchr(p, ':'); > if (n) > *n++ = '\0'; > + if (*p == '\0') > + p = "."; > if (*p != '\0') { /* it's not a PATH="foo::bar" situation */ > p = concat_path_file(p, filename); > if (execable_file(p)) { > $ PATH=:/bin::/usr/bin: ./busybox which -a busybox > ./busybox > ./busybox > ./busybox > > To avoid a warning about "." being const, it should be written as > --- a/libbb/execable.c > +++ b/libbb/execable.c > @@ -37,14 +37,12 @@ char* FAST_FUNC find_execable(const char *filename, char > **PATHp) > > n = strchr(p, ':'); > if (n) > *n++ = '\0'; > - if (*p != '\0') { /* it's not a PATH="foo::bar" situation */ > - p = concat_path_file(p, filename); > + p = concat_path_file(*p ? p : ".", filename); > if (execable_file(p)) { > *PATHp = n; > return p; > } > free(p); > - } > p = n; > } /* on loop exit p == NULL */ > return p;
Applied, thanks! _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
