[RESEND,RFC,1/2] fbset: abort on not handled options

Message ID 20220925203114.1537909-1-dario.binacchi@amarulasolutions.com
State New
Headers show
Series
  • [RESEND,RFC,1/2] fbset: abort on not handled options
Related show

Commit Message

Dario Binacchi Sept. 25, 2022, 8:31 p.m. UTC
Not all options are actually implemented. In this case, return a message
and an error code to make it clear that the requested command has not
been executed.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
 util-linux/fbset.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

'Jan Kiszka' via Amarula Linux Nov. 16, 2022, 12:41 p.m. UTC | #1
Applied both patches. Thank you.

On Sun, Sep 25, 2022 at 10:31 PM Dario Binacchi
<dario.binacchi@amarulasolutions.com> wrote:
>
> Not all options are actually implemented. In this case, return a message
> and an error code to make it clear that the requested command has not
> been executed.
>
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> ---
>  util-linux/fbset.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/util-linux/fbset.c b/util-linux/fbset.c
> index 41cc29f37b78..0eaa7c0a6427 100644
> --- a/util-linux/fbset.c
> +++ b/util-linux/fbset.c
> @@ -519,6 +519,9 @@ int fbset_main(int argc, char **argv)
>                                 var_set.bits_per_pixel = xatou32(argv[1]);
>                                 break;
>  #endif
> +                       default:
> +                               bb_perror_msg_and_die("option '%s' not handled",
> +                                                     g_cmdoptions[i].name);
>                         }
>                         switch (g_cmdoptions[i].code) {
>                         case CMD_FB:
> --
> 2.32.0
>

Patch

diff --git a/util-linux/fbset.c b/util-linux/fbset.c
index 41cc29f37b78..0eaa7c0a6427 100644
--- a/util-linux/fbset.c
+++ b/util-linux/fbset.c
@@ -519,6 +519,9 @@  int fbset_main(int argc, char **argv)
 				var_set.bits_per_pixel = xatou32(argv[1]);
 				break;
 #endif
+			default:
+				bb_perror_msg_and_die("option '%s' not handled",
+						      g_cmdoptions[i].name);
 			}
 			switch (g_cmdoptions[i].code) {
 			case CMD_FB: