From a9c0b699c0b6f43b4b60a6197ddccd34fb36efe4 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Sat, 11 May 2013 11:25:29 +0200 Subject: [PATCH] * grub-core/net/bootp.c (grub_cmd_bootp): Check if there is any card present. * include/grub/err.h (grub_err_t): New enum value GRUB_ERR_NET_NO_CARD. --- ChangeLog | 6 ++++++ grub-core/net/bootp.c | 3 +++ include/grub/err.h | 1 + 3 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0dedc844b..bbaed8412 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-05-11 Paulo Flabiano Smorigo + + * grub-core/net/bootp.c (grub_cmd_bootp): Check if there is any card + present. + * include/grub/err.h (grub_err_t): New enum value GRUB_ERR_NET_NO_CARD. + 2013-05-11 Vladimir Serbinenko * grub-core/tests/setjmp_test.c: Ignore missing noreturn. diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c index c8ef4d662..e0ab47e12 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -447,6 +447,9 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), ncards++; } + if (ncards == 0) + return grub_error (GRUB_ERR_NET_NO_CARD, N_("no network card found")); + ifaces = grub_zalloc (ncards * sizeof (ifaces[0])); if (!ifaces) return grub_errno; diff --git a/include/grub/err.h b/include/grub/err.h index 0f9b20830..9896fccf9 100644 --- a/include/grub/err.h +++ b/include/grub/err.h @@ -62,6 +62,7 @@ typedef enum GRUB_ERR_NET_ROUTE_LOOP, GRUB_ERR_NET_NO_ROUTE, GRUB_ERR_NET_NO_ANSWER, + GRUB_ERR_NET_NO_CARD, GRUB_ERR_WAIT, GRUB_ERR_BUG, GRUB_ERR_NET_PORT_CLOSED,