Skip to content

Commit 074dff7

Browse files
committed
libc: fix incorrect return value of _write_r call
Should return number of bytes written, actually returned zero. This resulted in std::cout going into failed state after the first write.
1 parent 97d0806 commit 074dff7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cores/esp8266/libc_replacements.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ int ICACHE_RAM_ATTR _read_r(struct _reent* unused, int file, char *ptr, int len)
8484

8585
int ICACHE_RAM_ATTR _write_r(struct _reent* r, int file, char *ptr, int len) {
8686
(void) r;
87+
int pos = len;
8788
if (file == STDOUT_FILENO) {
88-
while(len--) {
89+
while(pos--) {
8990
ets_putc(*ptr);
9091
++ptr;
9192
}

0 commit comments

Comments
 (0)