summary refs log tree commit diff stats
path: root/qga/main.c
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2013-05-18 06:31:53 +0200
committerMichael Roth <mdroth@linux.vnet.ibm.com>2013-05-30 11:37:37 -0500
commita839ee77c786a8200c76ca92f697eebf6bcc9aa3 (patch)
treeae11e9fc0f3850d32cac7fafa8d66223983d0df5 /qga/main.c
parenta880845f3d92e508e43fcc38f0631b91c203e5d5 (diff)
downloadfocaccia-qemu-a839ee77c786a8200c76ca92f697eebf6bcc9aa3.tar.gz
focaccia-qemu-a839ee77c786a8200c76ca92f697eebf6bcc9aa3.zip
qga: save state directory in ga_install_service()
If the user selects a non-default state directory at service installation
time, we should remember it in the registered service.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'qga/main.c')
-rw-r--r--qga/main.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/qga/main.c b/qga/main.c
index 5f2d141431..0e04e7395c 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -1022,7 +1022,16 @@ int main(int argc, char **argv)
         case 's':
             service = optarg;
             if (strcmp(service, "install") == 0) {
-                return ga_install_service(path, log_filepath);
+                const char *fixed_state_dir;
+
+                /* If the user passed the "-t" option, we save that state dir
+                 * in the service. Otherwise we let the service fetch the state
+                 * dir from the environment when it starts.
+                 */
+                fixed_state_dir = (state_dir == dfl_pathnames.state_dir) ?
+                                  NULL :
+                                  state_dir;
+                return ga_install_service(path, log_filepath, fixed_state_dir);
             } else if (strcmp(service, "uninstall") == 0) {
                 return ga_uninstall_service();
             } else {