a lot of bug potential here
This commit is contained in:
parent
2d6622b8b8
commit
c8469ca647
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
UnixFileGuard::UnixFileGuard(const std::string& device, int& fileDescriptor, int flags,
|
UnixFileGuard::UnixFileGuard(const std::string& device, int& fileDescriptor, int flags,
|
||||||
std::string diagnosticPrefix)
|
std::string diagnosticPrefix)
|
||||||
: cachedFd(fileDescriptor) {
|
: fdRef(fileDescriptor) {
|
||||||
fileDescriptor = open(device.c_str(), flags);
|
fileDescriptor = open(device.c_str(), flags);
|
||||||
if (fileDescriptor < 0) {
|
if (fileDescriptor < 0) {
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
@ -24,6 +24,6 @@ UnixFileGuard::UnixFileGuard(const std::string& device, int& fileDescriptor, int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UnixFileGuard::~UnixFileGuard() { close(cachedFd); }
|
UnixFileGuard::~UnixFileGuard() { close(fdRef); }
|
||||||
|
|
||||||
ReturnValue_t UnixFileGuard::getOpenResult() const { return openStatus; }
|
ReturnValue_t UnixFileGuard::getOpenResult() const { return openStatus; }
|
||||||
|
@ -31,7 +31,7 @@ class UnixFileGuard {
|
|||||||
ReturnValue_t getOpenResult() const;
|
ReturnValue_t getOpenResult() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int cachedFd = 0;
|
int& fdRef;
|
||||||
ReturnValue_t openStatus = returnvalue::OK;
|
ReturnValue_t openStatus = returnvalue::OK;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user