pxe: Fix crash if 'sysboot' is run without args
PATCH 1/2 pxe: Fix crash if 'sysboot' is run without args
Previously, a NULL pointer dereference would occur if the 'sysboot' command is executed without any arguments.
--- common/cmd_pxe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
cmd_pxe.c +1 -1
@@ -1648,7 +1648,7 @@ static int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) is_pxe = false; -if (strstr (argv[1 ],"-p" )) { +if (argc >1 &&strstr (argv[1 ],"-p" )) { prompt =1 ; argc--; argv++;
Signature · 1 line
2.4.0
PATCH 2/2 menu: Return an error code if Ctrl-C is pressed
Previously, if the menu activated by the 'sysboot' command gets interrupted by a Ctrl-C, the behaviour is as if the menu timeout was reached - i.e. boot the default menu entry. This patch fixes that so a Ctrl-C now terminates the command as the user would expect.
--- common/menu.c | 3 +++ 1 file changed, 3 insertions(+)
menu.c +3 -0
@@ -202,6 +202,9 @@ static inline int menu_interactive_choice(struct menu *m, void **choice) choice_item =menu_item_by_key (m, cbuf);if (!choice_item)printf ("%s not found\n" , cbuf); + }else if (readret ==-1 ) { +printf ("<INTERRUPT>\n" ); +return -EINTR ; }else {return menu_default_choice (m, choice); }
Signature · 1 line
2.4.0
PATCH 2/2 menu: Return an error code if Ctrl-C is pressed
Hi Tuomas,
Quoted 25 lines · Tuomas Tynkkynen
Previously, if the menu activated by the 'sysboot' command gets interrupted by a Ctrl-C, the behaviour is as if the menu timeout was reached - i.e. boot the default menu entry. This patch fixes that so a Ctrl-C now terminates the command as the user would expect.
Signed-off-by Tuomas Tynkkynen <[email protected]>--- common/menu.c | 3 +++ 1 file changed, 3 insertions(+)menu.c +3
-1@@ -202,6 +202,9 @@ static inline int menu_interactive_choice(struct menu *m, void **choice) choice_item =menu_item_by_key (m, cbuf);if (!choice_item)printf ("%s not found\n" , cbuf); + }else if (readret ==-1 ) { +printf ("<INTERRUPT>\n" ); +return -EINTR ; }else {return menu_default_choice (m, choice); } --
Quoted 2 lines
2.4.0
If you feel like doing another patch, you could update the cli_readline_into_buffer() and cread_line() to describe the meaning of the return values (-1 and -2). Even better if you can use -EINTR and -ETIMEDOUT.
Regards,
Simon
PATCH 2/2 menu: Return an error code if Ctrl-C is pressed
In reply to Tuomas TynkkynenQuoted 7 lines · Tuomas Tynkkynen
Previously, if the menu activated by the 'sysboot' command gets interrupted by a Ctrl-C, the behaviour is as if the menu timeout was reached - i.e. boot the default menu entry. This patch fixes that so a Ctrl-C now terminates the command as the user would expect.
Signed-off-by Tuomas Tynkkynen <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150528/0beaf132/attachment.sig>
PATCH 1/2 pxe: Fix crash if 'sysboot' is run without args
In reply to Tuomas TynkkynenQuoted 7 lines · Tuomas Tynkkynen
Previously, a NULL pointer dereference would occur if the 'sysboot' command is executed without any arguments.
Signed-off-by Tuomas Tynkkynen <[email protected]>--- common/cmd_pxe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH 1/2 pxe: Fix crash if 'sysboot' is run without args
In reply to Tuomas TynkkynenQuoted 5 lines · Tuomas Tynkkynen
Previously, a NULL pointer dereference would occur if the 'sysboot' command is executed without any arguments.
Signed-off-by Tuomas Tynkkynen <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150528/a08a26b5/attachment.sig>