From b8d3884eb68f63ea4a4e939b3a7ca70f9d33f546 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Tue, 19 May 2015 18:54:15 -1000 Subject: [PATCH] Ensured close in all paths. This still needed the EAGAIN logic added --- .../posix/include/uavcan_posix/file_server_backend.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libuavcan_drivers/posix/include/uavcan_posix/file_server_backend.hpp b/libuavcan_drivers/posix/include/uavcan_posix/file_server_backend.hpp index 963982bb23..d6280e6bc3 100644 --- a/libuavcan_drivers/posix/include/uavcan_posix/file_server_backend.hpp +++ b/libuavcan_drivers/posix/include/uavcan_posix/file_server_backend.hpp @@ -78,7 +78,7 @@ public: len = ::read(fd, bytes, MaxBufferLength); if (len < 0) { - return rv; + goto out_close; } if (len > 0) { @@ -87,7 +87,6 @@ public: } } while(len); - close(fd); out_crc64 = crc.get(); out_size = size; EntryType t; @@ -95,6 +94,9 @@ public: out_type = t; rv = 0; } + +out_close: + close(fd); } return rv; }