]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: expose swap priority value via dbus only if it is set
authorLennart Poettering <lennart@poettering.net>
Thu, 9 Jan 2020 16:01:14 +0000 (17:01 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 9 Jan 2020 16:08:10 +0000 (17:08 +0100)
src/core/dbus-swap.c

index 353fa201321a900d57f6f9afbc9fb463dfeae2b4..57c8c42091fd95750df6684acf8c3e473d3f89c3 100644 (file)
 #include "unit.h"
 
 static int swap_get_priority(Swap *s) {
-        if (s->from_proc_swaps)
+        assert(s);
+
+        if (s->from_proc_swaps && s->parameters_proc_swaps.priority_set)
                 return s->parameters_proc_swaps.priority;
-        if (s->from_fragment)
+
+        if (s->from_fragment && s->parameters_fragment.priority_set)
                 return s->parameters_fragment.priority;
+
         return -1;
 }
 
 static const char *swap_get_options(Swap *s) {
+        assert(s);
+
         if (s->from_fragment)
                 return s->parameters_fragment.options;
+
         return NULL;
 }