summaryrefslogtreecommitdiff
path: root/src/shared/install-printf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/install-printf.c')
-rw-r--r--src/shared/install-printf.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/shared/install-printf.c b/src/shared/install-printf.c
index 88143361da..9fc915d62e 100644
--- a/src/shared/install-printf.c
+++ b/src/shared/install-printf.c
@@ -27,6 +27,7 @@
#include "install.h"
#include "macro.h"
#include "specifier.h"
+#include "string-util.h"
#include "unit-name.h"
#include "user-util.h"
@@ -47,7 +48,7 @@ static int specifier_prefix(char specifier, void *data, void *userdata, char **r
}
static int specifier_instance(char specifier, void *data, void *userdata, char **ret) {
- UnitFileInstallInfo *i = userdata;
+ const UnitFileInstallInfo *i = userdata;
char *instance;
int r;
@@ -57,8 +58,8 @@ static int specifier_instance(char specifier, void *data, void *userdata, char *
if (r < 0)
return r;
- if (!instance) {
- instance = strdup("");
+ if (isempty(instance)) {
+ instance = strdup(i->default_instance ?: "");
if (!instance)
return -ENOMEM;
}