]> err.no Git - systemd/commitdiff
swap: avoid bad memory access v183
authorLennart Poettering <lennart@poettering.net>
Thu, 24 May 2012 15:33:50 +0000 (17:33 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 24 May 2012 15:33:50 +0000 (17:33 +0200)
src/core/swap.c

index f677d65bd27d4a82718aa86f1624ebc95af773c3..e7ed1b88d728c710a813c87aeef5103d80e4e20c 100644 (file)
@@ -535,25 +535,30 @@ static void swap_dump(Unit *u, FILE *f, const char *prefix) {
                 p = &s->parameters_proc_swaps;
         else if (s->from_fragment)
                 p = &s->parameters_fragment;
+        else
+                p = NULL;
 
         fprintf(f,
                 "%sSwap State: %s\n"
                 "%sResult: %s\n"
                 "%sWhat: %s\n"
-                "%sPriority: %i\n"
-                "%sNoAuto: %s\n"
-                "%sNoFail: %s\n"
                 "%sFrom /proc/swaps: %s\n"
                 "%sFrom fragment: %s\n",
                 prefix, swap_state_to_string(s->state),
                 prefix, swap_result_to_string(s->result),
                 prefix, s->what,
-                prefix, p->priority,
-                prefix, yes_no(p->noauto),
-                prefix, yes_no(p->nofail),
                 prefix, yes_no(s->from_proc_swaps),
                 prefix, yes_no(s->from_fragment));
 
+        if (p)
+                fprintf(f,
+                        "%sPriority: %i\n"
+                        "%sNoAuto: %s\n"
+                        "%sNoFail: %s\n",
+                        prefix, p->priority,
+                        prefix, yes_no(p->noauto),
+                        prefix, yes_no(p->nofail));
+
         if (s->control_pid > 0)
                 fprintf(f,
                         "%sControl PID: %lu\n",