]> xenbits.xensource.com Git - libvirt.git/commit
util: honor anchored names when searching for executables
authorEric Blake <eblake@redhat.com>
Tue, 12 Jul 2011 22:47:01 +0000 (16:47 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 13 Jul 2011 13:30:42 +0000 (07:30 -0600)
commit51fc56553f33d720d5d95900469a77f4ea9685b9
treece6ee58a87fb8e5449666c05deb991d976a1c63f
parent83d768fab816dccc34fd3fa0d5e56f4ee9597550
util: honor anchored names when searching for executables

I got bit in a debugging session on an uninstalled libvirtd; the
code tried to call out to the installed $LIBEXECDIR/libvirt_iohelper
instead of my just-built version.  So I set a breakpoint and altered
the binary name to be "./src/libvirt_iohelper", and it still failed
because I don't have "." on my PATH.

According to POSIX, execvp only searches PATH if the name does
not contain a slash.  Since we are trying to mimic that behavior,
an anchored name should be relative to the current working dir.

This tightens existing behavior, but most callers already pass
an absolute name or a name with no slashes, so it probably won't
be noticeable.

* src/util/util.c (virFindFileInPath): Anchored relative names do
not invoke a PATH search.
src/util/util.c