]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix #612: create service with service.conf in present directory and
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 29 Sep 2014 09:27:22 +0000 (09:27 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 29 Sep 2014 09:27:22 +0000 (09:27 +0000)
  auto load it.

git-svn-id: file:///svn/unbound/trunk@3232 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
winrc/w_inst.c

index 1df8749e872439e4d3a3e7991da1fc9043f84c40..6fa88001726b6f670bf06eb27f5d114d78ed5c4a 100644 (file)
@@ -1,3 +1,8 @@
+29 September 2014: Wouter
+       - Fix #612: create service with service.conf in present directory and
+         auto load it.
+       - Fix for mingw compile openssl ranlib.
+
 25 September 2014: Wouter
        - updated configure and aclocal with newer autoconf 1.13.
 
index a418ca8aae79ce26ca659cdad310dcd8e22b95ab..d0de73b5bcbd381854bdf75566f6443255939944 100644 (file)
@@ -190,19 +190,32 @@ wsvc_install(FILE* out, const char* rename)
 {
         SC_HANDLE scm;
         SC_HANDLE sv;
-        TCHAR path[MAX_PATH+2+256];
+        TCHAR path[2*MAX_PATH+4+256];
+        TCHAR path_config[2*MAX_PATH+4+256];
         if(out) fprintf(out, "installing unbound service\n");
         if(!GetModuleFileName(NULL, path+1, MAX_PATH))
                 fatal_win(out, "could not GetModuleFileName");
         /* change 'unbound-service-install' to 'unbound' */
-       if(rename)
+       if(rename) {
                change(out, path+1, sizeof(path)-1, rename, "unbound.exe");
+               memmove(path_config+1, path+1, sizeof(path)-1);
+               change(out, path_config+1, sizeof(path_config)-1,
+                       "unbound.exe", "service.conf");
+       }
 
        event_reg_install(out, path+1);
 
         /* have to quote it because of spaces in directory names */
         /* could append arguments to be sent to ServiceMain */
         quote_it(out, path, sizeof(path));
+
+       /* if we started in a different directory, also read config from it. */
+       if(rename) {
+               quote_it(out, path_config, sizeof(path_config));
+               strcat(path, " -c ");
+               strcat(path, path_config);
+       }
+
         strcat(path, " -w service");
         scm = OpenSCManager(NULL, NULL, (int)SC_MANAGER_CREATE_SERVICE);
         if(!scm) fatal_win(out, "could not OpenSCManager");