From ee691d84333a67fe914c05a928adb4c9d3b3deca Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 22 Mar 2011 16:39:01 -0600 Subject: [PATCH] command: reject pidfile on non-daemon * src/util/command.c (virCommandRunAsync): Since virExec only creates pidfiles for daemon, enforce this in virCommand. --- src/util/command.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/util/command.c b/src/util/command.c index 22f350b656..a33d3339cf 100644 --- a/src/util/command.c +++ b/src/util/command.c @@ -1146,7 +1146,11 @@ virCommandRunAsync(virCommandPtr cmd, pid_t *pid) cmd->pwd); return -1; } - + if (cmd->pidfile && !(cmd->flags & VIR_EXEC_DAEMON)) { + virCommandError(VIR_ERR_INTERNAL_ERROR, "%s", + _("creation of pid file requires daemonized command")); + return -1; + } str = virCommandToString(cmd); VIR_DEBUG("About to run %s", str ? str : cmd->args[0]);