Skip to content

Commit b01eda1

Browse files
committed
Print not aborting on write failure
See #3614
1 parent 9552cc6 commit b01eda1

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

build/shared/revisions.txt

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ ARDUINO 1.6.6
3131
[core]
3232
* AVR: fixed wrong turnOffPWM() for TIMER0B. Thanks @gonzoveliki
3333
* ArduinoISP is now compatible with every architecture (not only AVR) and is much more stable. Thanks @PeterVH
34+
* Print not aborting on write() failure. Thanks @stickbreaker
3435

3536
ARDUINO 1.6.5-r5 - 2015.08.28
3637

hardware/arduino/sam/cores/arduino/Print.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1818
1919
Modified 23 November 2006 by David A. Mellis
20+
Modified 03 August 2015 by Chuck Todd
2021
*/
2122

2223
#include <stdlib.h>
@@ -34,7 +35,8 @@ size_t Print::write(const uint8_t *buffer, size_t size)
3435
{
3536
size_t n = 0;
3637
while (size--) {
37-
n += write(*buffer++);
38+
if (write(*buffer++)) n++;
39+
else break;
3840
}
3941
return n;
4042
}

0 commit comments

Comments
 (0)