From 8c0c70536fcfc92ff0639481bcfb7c3ae9445ec6 Mon Sep 17 00:00:00 2001 From: matt Date: Wed, 5 Apr 2017 01:57:15 -0400 Subject: [PATCH 1/7] Search bug fix stop duplicate printing of cache device --- grub-core/commands/search.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c index 7dd32e4..2fea001 100644 --- a/grub-core/commands/search.c +++ b/grub-core/commands/search.c @@ -52,6 +52,7 @@ struct search_ctx unsigned nhints; int count; int is_cache; + const char *print_once; }; /* Helper for FUNC_NAME. */ @@ -60,6 +61,10 @@ iterate_device (const char *name, void *data) { struct search_ctx *ctx = data; int found = 0; +/*This is to skip over re-iterating device if the device info was just cached + on an earlier iteration. So it does not print the same device name twice*/ +if(grub_strcmp (ctx->print_once, name) != 0) +{ /* Skip floppy drives when requested. */ if (ctx->no_floppy && @@ -157,9 +162,15 @@ iterate_device (const char *name, void *data) if (ctx->var) grub_env_set (ctx->var, name); else + { + if(ctx->is_cache) + { + ctx->print_once = grub_strdup (name); + } grub_printf (" %s", name); + } } - +} grub_errno = GRUB_ERR_NONE; return (found && ctx->var); } -- 2.7.4