supermin/0001-helper-Don-t-crash-if-...

40 lines
1.1 KiB
Diff

From a55d9cf1579f14545636b3d7a2f515c413603107 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 8 Sep 2013 11:13:24 +0100
Subject: [PATCH] helper: Don't crash if SUPERMIN_DTB is set and no --dtb on
the command line.
Libguestfs uses supermin-helper -f checksum w/o --dtb. Setting the
SUPERMIN_DTB environment variable would cause supermin-helper to
crash. Instead of crashing, just ignore SUPERMIN_DTB.
---
helper/kernel.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/helper/kernel.c b/helper/kernel.c
index 4ff207b..5c8175d 100644
--- a/helper/kernel.c
+++ b/helper/kernel.c
@@ -122,15 +122,15 @@ has_modpath (const char *kernel_name)
static void
get_dtb (const char *kernel, const char *dtb_wildcard, const char *dtb)
{
+ if (!dtb_wildcard)
+ return;
+
char *dtb_env = getenv ("SUPERMIN_DTB");
if (dtb_env) {
copy_or_symlink_file ("dtb", dtb_env, dtb);
return;
}
- if (!dtb_wildcard)
- return;
-
assert (dtb); /* command line arg parsing should ensure this */
assert (kernel != NULL);
--
1.8.3.1