File makedumpfile-call-open_dump_bitmap-after-initial.patch of Package makedumpfile

From: Martin Wilck <mwilck@suse.de>
Date: Wed, 10 Aug 2016 14:56:57 +0200
Subject: move call to open_dump_bitmap() to after call to initial()
References: bsc#992885

When open_files_for_creating_dumpfile() is called, we don't have all
necessary information to determine whether a bitmap file is actually
needed. In particular, we don't know whether info->flag_cyclic will
ultimately be set. This patch moves the call to open_dump_bitmap()
to after initialize() when all flags are known.

For the dump_dmesg() path, no bitmap file is needed.

Signed-off-by: Martin Wilck <mwilck@suse.de>
Acked-by: Petr Tesarik <ptesarik@suse.com>

---
 makedumpfile.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -1480,9 +1480,6 @@ open_files_for_creating_dumpfile(void)
 	if (!open_dump_memory())
 		return FALSE;
 
-	if (!open_dump_bitmap())
-		return FALSE;
-
 	return TRUE;
 }
 
@@ -9724,6 +9721,9 @@ create_dumpfile(void)
 	if (!initial())
 		return FALSE;
 
+	if (!open_dump_bitmap())
+		return FALSE;
+
 	/* create an array of translations from pfn to vmemmap pages */
 	if (info->flag_excludevm) {
 		if (find_vmemmap() == FAILED) {
@@ -10894,6 +10894,9 @@ int show_mem_usage(void)
 	if (!initial())
 		return FALSE;
 
+	if (!open_dump_bitmap())
+		return FALSE;
+
 	if (!prepare_bitmap_buffer())
 		return FALSE;
 
openSUSE Build Service is sponsored by