summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--device.c3
-rw-r--r--service.c3
-rw-r--r--socket.c3
-rw-r--r--target.c3
4 files changed, 12 insertions, 0 deletions
diff --git a/device.c b/device.c
index 25661e05f8..d99038f77e 100644
--- a/device.c
+++ b/device.c
@@ -49,6 +49,9 @@ static void device_set_state(Device *d, DeviceState state) {
DeviceState old_state;
assert(d);
+ if (state == d->state)
+ return;
+
old_state = d->state;
d->state = state;
diff --git a/service.c b/service.c
index 7ed9783f79..74d03dbe1d 100644
--- a/service.c
+++ b/service.c
@@ -968,6 +968,9 @@ static void service_set_state(Service *s, ServiceState state) {
state == SERVICE_AUTO_RESTART)
service_notify_sockets(s);
+ if (old_state == state)
+ return;
+
log_debug("%s changed %s → %s", unit_id(UNIT(s)), service_state_to_string(old_state), service_state_to_string(state));
unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state]);
diff --git a/socket.c b/socket.c
index 4e3522505f..617a49a075 100644
--- a/socket.c
+++ b/socket.c
@@ -391,6 +391,9 @@ static void socket_set_state(Socket *s, SocketState state) {
if (state != SOCKET_LISTENING)
socket_unwatch_fds(s);
+ if (state == old_state)
+ return;
+
log_debug("%s changed %s → %s", unit_id(UNIT(s)), state_string_table[old_state], state_string_table[state]);
unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state]);
diff --git a/target.c b/target.c
index b8a7442f1c..c80c09d546 100644
--- a/target.c
+++ b/target.c
@@ -52,6 +52,9 @@ static void target_set_state(Target *t, TargetState state) {
TargetState old_state;
assert(t);
+ if (state == t->state)
+ return;
+
old_state = t->state;
t->state = state;