richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
149adf
From 74854679448851e04ee8f6f10cf7908e3273e989 Mon Sep 17 00:00:00 2001
149adf
From: Michal Sekletar <msekleta@redhat.com>
149adf
Date: Thu, 15 Oct 2020 16:48:39 +0200
149adf
Subject: [PATCH] core: don't update unit description if it is already set to
149adf
 the same value
149adf
149adf
This is a followup for 47f260a680046d3f9244fffa1ea978041811bf6a as that
149adf
actually relies on such behavior of unit_set_description().
149adf
149adf
RHEL-only
149adf
149adf
Related: #1793527
149adf
---
149adf
 src/core/unit.c | 3 +++
149adf
 1 file changed, 3 insertions(+)
149adf
149adf
diff --git a/src/core/unit.c b/src/core/unit.c
149adf
index d953780a52..18b1b898fd 100644
149adf
--- a/src/core/unit.c
149adf
+++ b/src/core/unit.c
149adf
@@ -273,6 +273,9 @@ int unit_set_description(Unit *u, const char *description) {
149adf
         if (isempty(description))
149adf
                 s = NULL;
149adf
         else {
149adf
+                if (streq_ptr(u->description, description))
149adf
+                        return 0;
149adf
+
149adf
                 s = strdup(description);
149adf
                 if (!s)
149adf
                         return -ENOMEM;