Don't let tinc service depend on NDIS component.
[tinc] / src / process.c
index 7500259..a4e2548 100644 (file)
@@ -104,7 +104,7 @@ bool install_service(void) {
 
        service = CreateService(manager, identname, identname,
                        SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL,
-                       command, "NDIS", NULL, NULL, NULL, NULL);
+                       command, NULL, NULL, NULL, NULL, NULL);
        
        if(!service) {
                logger(LOG_ERR, _("Could not create %s service: %s"), identname, winerror(GetLastError()));
@@ -362,7 +362,7 @@ bool execute_script(const char *name, char **envp)
 #ifdef HAVE_SYSTEM
        int status, len;
        struct stat s;
-       char *scriptname;
+       char *scriptname, *p;
        int i;
 
        cp();
@@ -400,8 +400,12 @@ bool execute_script(const char *name, char **envp)
 
        for(i = 0; envp[i]; i++) {
                char *e = strchr(envp[i], '=');
-               if(e)
-                       putenv(strndupa(envp[i], e - envp[i]));
+               if(e) {
+                       p = alloca(e - envp[i] + 1);
+                       strncpy(p, envp[i], e - envp[i]);
+                       p[e - envp[i]] = '\0';
+                       putenv(p);
+               }
        }
 
 #ifdef WEXITSTATUS