2010/12/7 Eric Blake <eblake@xxxxxxxxxx>: > * docs/internals/command.html.in: Better documentation of buffer > vs. fd considerations. > * src/util/command.c (virCommandRunAsync): Reject raw execution > with string io. > (virCommandRun): Reject execution with user-specified fds not > visiting a regular file. > --- > > Perhaps we need to relax the fstat check to permit block devices > in addition to regular files; but that can be a later patch if needed. > > Âdocs/internals/command.html.in |  35 ++++++++++++++++++++++++++--------- > Âsrc/util/command.c       |  37 ++++++++++++++++++++++++++++++++++++- > Â2 files changed, 62 insertions(+), 10 deletions(-) > +  Âif (async_io ? (!(cmd->flags & VIR_EXEC_DAEMON) || string_io) > +    Â: ((cmd->flags & VIR_EXEC_DAEMON) && string_io)) { > +    ÂvirCommandError(VIR_ERR_INTERNAL_ERROR, "%s", > +            Â_("invalid use of command API")); > +    Âreturn -1; > +  Â} > +  Â/* Buffer management can only be requested via virCommandRun. Â*/ > +  Âif ((cmd->inbuf && cmd->infd == -1) || > +    Â(cmd->outbuf && cmd->outfdptr != &cmd->outfd) || > +    Â(cmd->errbuf && cmd->errfdptr != &cmd->errfd)) { > +    ÂvirCommandError(VIR_ERR_INTERNAL_ERROR, "%s", > +            Â_("invalid use of command API")); > +    Âreturn -1; > +  Â} Maybe make the error message about invalid use distinct from each other. That would allow to tell based on the error message what type of invalid usage has happened. ACK. Matthias -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list