From 250837965eeb2395b930952e9d8b72fd2368ff08 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Wed, 3 Jun 2015 01:49:54 +0300 Subject: [PATCH] Minor fixes to BasicFileSeverBackend --- .../uavcan_posix/basic_file_server_backend.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libuavcan_drivers/posix/include/uavcan_posix/basic_file_server_backend.hpp b/libuavcan_drivers/posix/include/uavcan_posix/basic_file_server_backend.hpp index 1615b06a6a..bec6d91fd7 100644 --- a/libuavcan_drivers/posix/include/uavcan_posix/basic_file_server_backend.hpp +++ b/libuavcan_drivers/posix/include/uavcan_posix/basic_file_server_backend.hpp @@ -70,15 +70,15 @@ protected: /// Rate in Seconds that the cache will be flushed of stale entries. enum { GarbageCollectionSeconds = 60 }; - class FDCacheItem + class FDCacheItem : uavcan::Noncopyable { friend FDCache; FDCacheItem* next_; time_t last_access_; - int fd_; - int oflags_; - const char* path_; + const int fd_; + const int oflags_; + const char* const path_; public: enum { InvalidFD = -1 }; @@ -88,7 +88,7 @@ protected: last_access_(0), fd_(InvalidFD), oflags_(0), - path_(0) + path_(NULL) { } FDCacheItem(int fd, const char* path, int oflags) : @@ -96,14 +96,14 @@ protected: last_access_(0), fd_(fd), oflags_(oflags), - path_(strdup(path)) + path_(::strndup(path, uavcan::protocol::file::Path::FieldTypes::path::MaxSize)) { } ~FDCacheItem() { if (valid()) { - delete path_; + ::free(const_cast(path_)); } }