[Patch] kexec/crashdump.c: improve the code a bit

WANG Cong xiyou.wangcong at gmail.com
Tue Jun 24 17:03:56 EDT 2008


Add the missing fclose().
Constify a char pointer.

Signed-off-by: WANG Cong <wangcong at zeuux.org>

---
diff --git a/kexec/crashdump.c b/kexec/crashdump.c
index e0ba36d..92de524 100644
--- a/kexec/crashdump.c
+++ b/kexec/crashdump.c
@@ -107,10 +107,11 @@ int get_crash_notes_per_cpu(int cpu, uint64_t *addr, uint64_t *len)
 	printf("crash_notes addr = %Lx\n", *addr);
 #endif
 
+	fclose(fp);
 	return 0;
 }
 
-static int get_vmcoreinfo(char *kdump_info, uint64_t *addr, uint64_t *len)
+static int get_vmcoreinfo(const char *kdump_info, uint64_t *addr, uint64_t *len)
 {
 	char line[MAX_LINE];
 	int count;
@@ -132,6 +133,7 @@ static int get_vmcoreinfo(char *kdump_info, uint64_t *addr, uint64_t *len)
 	*addr = (uint64_t) temp;
 	*len = (uint64_t) temp2;
 
+	fclose(fp);
 	return 0;
 }
 




More information about the kexec mailing list