mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #15431 from alrvid/patch-1
Handle negative values passed to close()pull/15435/head
commit
f9c0cd2a94
|
@ -656,6 +656,10 @@ extern "C" int PREFIX(_close)(FILEHANDLE fh)
|
||||||
#if !MBED_CONF_PLATFORM_STDIO_MINIMAL_CONSOLE_ONLY
|
#if !MBED_CONF_PLATFORM_STDIO_MINIMAL_CONSOLE_ONLY
|
||||||
extern "C" int close(int fildes)
|
extern "C" int close(int fildes)
|
||||||
{
|
{
|
||||||
|
if (fildes < 0) {
|
||||||
|
errno = EBADF;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
FileHandle *fhc = mbed_file_handle(fildes);
|
FileHandle *fhc = mbed_file_handle(fildes);
|
||||||
filehandles[fildes] = NULL;
|
filehandles[fildes] = NULL;
|
||||||
if (fhc == NULL) {
|
if (fhc == NULL) {
|
||||||
|
|
Loading…
Reference in New Issue