chiark / gitweb /
build-sys: fix 'make fedora'
[elogind.git] / src / service.c
index 7a522bf3f47d865dde181fa2a33d16f014f5edb5..46d7bbb1c7b17774706dd43ef15f7be8b7194d68 100644 (file)
@@ -1568,7 +1568,7 @@ static int service_spawn(
                 goto fail;
         }
 
-        if (!(our_env = new0(char*, 3))) {
+        if (!(our_env = new0(char*, 4))) {
                 r = -ENOMEM;
                 goto fail;
         }
@@ -1585,6 +1585,16 @@ static int service_spawn(
                         goto fail;
                 }
 
+#ifdef HAVE_SYSV_COMPAT
+        /* Make sure we set TERM=linux for SysV scripts, since some
+         * require it to be set from the kernel */
+        if (s->sysv_path && !strv_env_get(s->meta.manager->environment, "TERM"))
+                if (!(our_env[n_env++] = strdup("TERM=linux"))) {
+                        r = -ENOMEM;
+                        goto fail;
+                }
+#endif
+
         if (!(final_env = strv_env_merge(2,
                                          s->meta.manager->environment,
                                          our_env,