]> xenbits.xensource.com Git - libvirt.git/commitdiff
command: reject pidfile on non-daemon
authorEric Blake <eblake@redhat.com>
Tue, 22 Mar 2011 22:39:01 +0000 (16:39 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 23 Mar 2011 21:01:28 +0000 (15:01 -0600)
* src/util/command.c (virCommandRunAsync): Since virExec only
creates pidfiles for daemon, enforce this in virCommand.

src/util/command.c

index 22f350b656802577b86d1d6c0c8f42cefc20e0c4..a33d3339cfcf1570a3c8d819060a9e7b70db57d5 100644 (file)
@@ -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]);