]> git.proxmox.com Git - qemu.git/commitdiff
qga: save state directory in ga_install_service()
authorLaszlo Ersek <lersek@redhat.com>
Sat, 18 May 2013 04:31:53 +0000 (06:31 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 23 Jul 2013 17:01:16 +0000 (12:01 -0500)
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>
(cherry picked from commit a839ee77c786a8200c76ca92f697eebf6bcc9aa3)

* modified to save state_dir unconditionally an avoid reliance on
  uncommitted CSIDL_COMMON_APPDATA dependencies

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qga/main.c
qga/service-win32.c
qga/service-win32.h

index 44a283686bbf870a4a1adaa19a9d78f4c3a31108..c2ba5d91393e7ba525e4c88591b22e07c0ec9071 100644 (file)
@@ -1002,7 +1002,8 @@ 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;
+                return ga_install_service(path, log_filepath, state_dir);
             } else if (strcmp(service, "uninstall") == 0) {
                 return ga_uninstall_service();
             } else {
index 8a5de8a8b91b34017723c783c59f0e2e2bf6f652..02926abb285391a5b289ef5f3ce33f8baf677477 100644 (file)
@@ -35,7 +35,8 @@ static int printf_win_error(const char *text)
     return n;
 }
 
-int ga_install_service(const char *path, const char *logfile)
+int ga_install_service(const char *path, const char *logfile,
+                       const char *state_dir)
 {
     SC_HANDLE manager;
     SC_HANDLE service;
@@ -56,6 +57,9 @@ int ga_install_service(const char *path, const char *logfile)
     if (logfile) {
         g_string_append_printf(cmdline, " -l %s -v", logfile);
     }
+    if (state_dir) {
+        g_string_append_printf(cmdline, " -t %s", state_dir);
+    }
 
     g_debug("service's cmdline: %s", cmdline->str);
 
index 99dfc5334894a1efd2bcfeb9acf7fdb805bed10b..3b9e87024b19848edf055ecb2867ace674137afb 100644 (file)
@@ -24,7 +24,8 @@ typedef struct GAService {
     SERVICE_STATUS_HANDLE status_handle;
 } GAService;
 
-int ga_install_service(const char *path, const char *logfile);
+int ga_install_service(const char *path, const char *logfile,
+                       const char *state_dir);
 int ga_uninstall_service(void);
 
 #endif