shell: fix possible deadlock in shell_fprintf

Disable shell print functions if the shell is not initialized.
Update tests accordingly.

Fixes #27161

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordisemi.no>
Signed-off-by: Steven Slupsky <sslupsky@gmail.com>
This commit is contained in:
Jakub Rzeszutko 2020-08-03 12:47:06 +02:00 committed by Anas Nashif
commit 920e64cfd4
4 changed files with 35 additions and 9 deletions

View file

@ -50,13 +50,20 @@ const struct shell *shell_backend_dummy_get_ptr(void);
*
* The returned data is always followed by a nul character at position *sizep
*
* @param shell Shell pointer
* @param sizep Returns size of data in shell buffer
* @param shell Shell pointer
* @param sizep Returns size of data in shell buffer
* @returns pointer to buffer containing shell output
*/
const char *shell_backend_dummy_get_output(const struct shell *shell,
size_t *sizep);
/**
* @brief Clears the output buffer in the shell backend.
*
* @param shell Shell pointer
*/
void shell_backend_dummy_clear_output(const struct shell *shell);
#ifdef __cplusplus
}
#endif