From: Zbigniew Jędrzejewski-Szmek Date: Tue, 7 Jun 2022 08:50:42 +0000 (+0200) Subject: basic/unit-file: make sure we don't call streq() on NULL X-Git-Tag: v252-rc1~845^2~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6c279977e3e065e8d3c14747d19dc2bf80150490;p=thirdparty%2Fsystemd.git basic/unit-file: make sure we don't call streq() on NULL add_names is called in two places, with fragment_basename=NULL in one of them. gcc warns that it can be NULL. Fixes #23646. --- diff --git a/src/basic/unit-file.c b/src/basic/unit-file.c index 83c29bb25f8..ac0236d6357 100644 --- a/src/basic/unit-file.c +++ b/src/basic/unit-file.c @@ -689,6 +689,7 @@ static int add_names( return log_debug_errno(r, "Cannot find instance fragment %s: %m", inst); if (inst_fragment && + fragment_basename && !streq(basename(inst_fragment), fragment_basename)) { log_debug("Instance %s has fragment %s and is not an alias of %s.", inst, inst_fragment, unit_name);