From fd87a4f180564cf823a7e8fbec9baa99e2682667 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 25 Aug 2016 13:57:58 +1000 Subject: [PATCH] DataFlash: fix unused result warning --- libraries/DataFlash/DataFlash_File.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/DataFlash/DataFlash_File.cpp b/libraries/DataFlash/DataFlash_File.cpp index f4f67c6ea8..f0c61962e3 100644 --- a/libraries/DataFlash/DataFlash_File.cpp +++ b/libraries/DataFlash/DataFlash_File.cpp @@ -861,9 +861,14 @@ uint16_t DataFlash_File::start_new_log(void) char buf[30]; snprintf(buf, sizeof(buf), "%u\r\n", (unsigned)log_num); - write(fd, buf, strlen(buf)); + const ssize_t to_write = strlen(buf); + const ssize_t written = write(fd, buf, to_write); close(fd); + if (written < to_write) { + return 0xFFFF; + } + return log_num; }