]> xenbits.xensource.com Git - libvirt.git/commit
virFindFileInPath: only find executable non-directory
authorEric Blake <eblake@redhat.com>
Wed, 12 Jan 2011 16:12:24 +0000 (09:12 -0700)
committerEric Blake <eblake@redhat.com>
Thu, 13 Jan 2011 15:10:55 +0000 (08:10 -0700)
commit9ae992f24353d6506f570fc9dd58355b165e4472
tree005563e11a263a03e61962404ef98d4fbed7060b
parent657cd084a9c3630c91c1a5788e755a178cfe364d
virFindFileInPath: only find executable non-directory

Without this patch, at least tests/daemon-conf (which sticks
$builddir/src in the PATH) tries to execute the directory
$builddir/src/qemu rather than a real qemu binary.

* src/util/util.h (virFileExists): Adjust prototype.
(virFileIsExecutable): New prototype.
* src/util/util.c (virFindFileInPath): Reject non-executables and
directories.  Avoid huge stack allocation.
(virFileExists): Use lighter-weight syscall.
(virFileIsExecutable): New function.
* src/libvirt_private.syms (util.h): Export new function.
src/libvirt_private.syms
src/util/util.c
src/util/util.h