chiark / gitweb /
sd-daemon: introduce sd_watchdog_enabled() for parsing $WATCHDOG_USEC
[elogind.git] / src / core / service.c
index 87eaa29378b369a19c4cf462588e4adf6a90be55..4eb3d9e6688d1ff4990dc30a08d424f8001b2135 100644 (file)
@@ -1750,7 +1750,7 @@ static int service_spawn(
         if (r < 0)
                 goto fail;
 
-        our_env = new0(char*, 5);
+        our_env = new0(char*, 4);
         if (!our_env) {
                 r = -ENOMEM;
                 goto fail;
@@ -1768,12 +1768,6 @@ static int service_spawn(
                         goto fail;
                 }
 
-        if (s->watchdog_usec > 0)
-                if (asprintf(our_env + n_env++, "WATCHDOG_USEC=%llu", (unsigned long long) s->watchdog_usec) < 0) {
-                        r = -ENOMEM;
-                        goto fail;
-                }
-
         if (UNIT(s)->manager->running_as != SYSTEMD_SYSTEM)
                 if (asprintf(our_env + n_env++, "MANAGERPID=%lu", (unsigned long) getpid()) < 0) {
                         r = -ENOMEM;
@@ -1804,6 +1798,7 @@ static int service_spawn(
                        UNIT(s)->manager->cgroup_supported,
                        path,
                        UNIT(s)->id,
+                       s->watchdog_usec,
                        s->type == SERVICE_IDLE ? UNIT(s)->manager->idle_pipe : NULL,
                        s->exec_runtime,
                        &pid);