allow an empty DefaultInstance= in configuration files
authorJérémy Rosen <jeremy.rosen@smile.fr>
Fri, 1 Nov 2019 23:03:54 +0000 (00:03 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 4 Nov 2019 12:33:08 +0000 (13:33 +0100)
It is currently possible to override the DefaultInstance via drop-ins but
not remove it completely. Allow to do that by specifying an empty
DefaultInstance=

src/shared/install.c

index 0724dd9..17f6f99 100644 (file)
@@ -1191,6 +1191,11 @@ static int config_parse_default_instance(
         if (r < 0)
                 return r;
 
+        if (isempty(printed)) {
+                i->default_instance = mfree(i->default_instance);
+                return 0;
+        }
+
         if (!unit_instance_is_valid(printed))
                 return -EINVAL;