[libvirt] [PATCHv2 1/2] virFindFileInPath: only find executable non-directory
Daniel P. Berrange
berrange at redhat.com
Thu Jan 13 13:42:08 UTC 2011
On Wed, Jan 12, 2011 at 01:16:51PM -0700, Eric Blake wrote:
> 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.
> ---
>
> New in v2: Require S_ISREG, not !S_ISDIR; avoid access(X_OK) and
> instead document that ACLs are disregarded
>
> src/libvirt_private.syms | 1 +
> src/util/util.c | 53 ++++++++++++++++++++++++++++++---------------
> src/util/util.h | 7 +++--
> 3 files changed, 40 insertions(+), 21 deletions(-)
ACK
Daniel
More information about the libvir-list
mailing list