]> git.dujemihanovic.xyz Git - u-boot.git/commit
sandbox: don't call os_close with invalid file descriptor
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Wed, 10 Apr 2024 21:50:34 +0000 (23:50 +0200)
committerTom Rini <trini@konsulko.com>
Wed, 17 Apr 2024 23:06:16 +0000 (17:06 -0600)
commit2c3fa4b8add3cb6a440184ab67debc6867d383c0
tree477536ef7d6a78755acf46f58ae68cd7767a1d69
parentadf418d8c1d43388ebcb5f4ca87e113b27ff934f
sandbox: don't call os_close with invalid file descriptor

If open() fails it returns -1. Calling close() with this value
makes no sense. Return -EIO instead.

Addresses-Coverity-ID: 185828 Improper use of negative value
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Fixes: 566bf3a8698 ("sandbox: Add a function to read a host file")
Reviewed-by: Sean Anderson <seanga2@gmail.com>
arch/sandbox/cpu/os.c