[PATCH v2] commands: don't use stale errno when calling fb_open

Sascha Hauer s.hauer at pengutronix.de
Wed Jun 12 23:15:31 PDT 2019


On Tue, Jun 11, 2019 at 11:12:22AM +0200, Ahmad Fatoum wrote:
> fb_open returns a pointer and doesn't populate errno, which will
> result in a stale errno being evaluated by perror() on failure.
> Fix this by using strerror with the proper argument instead at call sites.
> 
> While at it, correct the message prefix typo (s/fb_open/fb_open/).
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
> Changes since v1:
>  * use strerror instead of perror/errno as suggested by Andrey & Sascha
>  * negated PTR_ERR output, so the error is positive
> 
>  commands/fbtest.c | 5 +++--
>  commands/splash.c | 5 +++--
>  2 files changed, 6 insertions(+), 4 deletions(-)

Applied, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list