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>
(cherry picked from commit a839ee77c7)

* 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>
This commit is contained in:
Laszlo Ersek authored and Michael Roth committed 2013-07-23 12:01:16 -05:00
1 parent c432c7d85a
commit 31c6ed2077
3 files changed
+9 -3

No files matched your search

+2 -1
View 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 {
+5 -1
View 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);
+2 -1
View 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