]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdmon.c
mdmon: don't lie to systemd.
[thirdparty/mdadm.git] / mdmon.c
diff --git a/mdmon.c b/mdmon.c
index 13f951096cfeaa354586f65931e84471fe73d16b..f0b062372b13f62587a17dd0f05636f78a2b0589 100644 (file)
--- a/mdmon.c
+++ b/mdmon.c
@@ -298,10 +298,14 @@ int main(int argc, char *argv[])
                {NULL, 0, NULL, 0}
        };
 
-       /*
-        * Always change process name to @dmon to avoid systemd killing it
-        */
-       argv[0][0] = '@';
+       if (in_initrd()) {
+               /*
+                * set first char of argv[0] to @. This is used by
+                * systemd to signal that the task was launched from
+                * initrd/initramfs and should be preserved during shutdown
+                */
+               argv[0][0] = '@';
+       }
 
        while ((opt = getopt_long(argc, argv, "thaF", options, NULL)) != -1) {
                switch (opt) {