Revert "fix(esp_libc): picolibc: add workaround for setvbuf on _IONBF"

This reverts commit 8b3414ba51.
This commit is contained in:
Alexey Lapshin
2026-04-21 12:47:27 +07:00
parent e44ddc22e2
commit 66e62fc9ef
2 changed files with 1 additions and 42 deletions

View File

@@ -1,39 +0,0 @@
/*
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdio-bufio.h>
#include <stdlib.h>
#include <stdbool.h>
int __real___bufio_setvbuf(FILE *f, char *buf, int mode, size_t size);
int __wrap___bufio_setvbuf(FILE *f, char *buf, int mode, size_t size)
{
// File lock is already acquired by the caller
int ret = -1;
bool workaround = false;
if (mode == _IONBF) {
workaround = true;
mode = _IOFBF;
size = 1;
buf = malloc(size);
if (buf == NULL) {
goto exit;
}
}
ret = __real___bufio_setvbuf(f, buf, mode, size);
if (workaround) {
struct __file_bufio *bf = (struct __file_bufio *)f;
// Free buf if not applied
if (ret != 0 || bf->buf != buf) {
free(buf);
goto exit;
}
bf->bflags |= __BALL;
}
exit:
return ret;
}