From fdfa4d2d35b0ecc7ee0ebe7e5bb3763e505a46d4 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Tue, 9 Jul 2013 21:20:08 +0000 Subject: [PATCH] Try to read firmware image before prompting the user to confirm firmware download. This correctly prints an error and exits for an incorrect firmware image name before prompting the user to confirm the download. Sponsored by: Intel MFC after: 3 days --- sbin/nvmecontrol/firmware.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/firmware.c b/sbin/nvmecontrol/firmware.c index c297f908cfb5..79adfb6cd3d3 100644 --- a/sbin/nvmecontrol/firmware.c +++ b/sbin/nvmecontrol/firmware.c @@ -253,6 +253,9 @@ firmware(int argc, char *argv[]) "of available images\n", slot, controller); + if (f_flag) + read_image_file(image, &buf, &size); + if (f_flag && a_flag) printf("You are about to download and activate " "firmware image (%s) to controller %s.\n" @@ -282,7 +285,6 @@ firmware(int argc, char *argv[]) } if (f_flag) { - read_image_file(image, &buf, &size); update_firmware(fd, buf, size); if (a_flag) activate_firmware(fd, slot,