summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-05-24 17:33:50 +0200
committerLennart Poettering <lennart@poettering.net>2012-05-24 17:33:50 +0200
commitb6bfc7bbee5132d60e37dfbafeb59ef5651d536b (patch)
treec7f4cdb3af545a03d7ecb200a0318f280cec203d
parentf8c0a2cb695e3b8140b51cb40637a09ba6eff48e (diff)
swap: avoid bad memory accessv183
-rw-r--r--src/core/swap.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/core/swap.c b/src/core/swap.c
index f677d65bd..e7ed1b88d 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -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",