buf[sizeof(buf)-1] = 0;
close(fd);
- /* Note that if started with --offroot, the name
- * might be "@dmon"
- */
if (n < 0 || !(strstr(buf, "mdmon") ||
strstr(buf, "@dmon")))
return;
" --help -h : This message\n"
" --all : All devices\n"
" --takeover -t : Takeover container\n"
-" --offroot : Set first character of argv[0] to @ to indicate the\n"
-" application was launched from initrd/initramfs and\n"
-" should not be shutdown by systemd as part of the\n"
-" regular shutdown process.\n"
);
exit(2);
}
{NULL, 0, NULL, 0}
};
+ /*
+ * Always change process name to @dmon to avoid systemd killing it
+ */
+ argv[0][0] = '@';
+
while ((opt = getopt_long(argc, argv, "tha", options, NULL)) != -1) {
switch (opt) {
case 'a':
takeover = 1;
break;
case OffRootOpt:
- argv[0][0] = '@';
+ /* silently ignore old option */
break;
case 'h':
default: