From 9897f5130720fd5a6c9a1dc40da3bf5b895fb29f Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 14 Feb 2022 08:43:10 +0100 Subject: [PATCH] added flose and changed warning message to error message --- hal/src/fsfw_hal/linux/uio/UioMapper.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/hal/src/fsfw_hal/linux/uio/UioMapper.cpp b/hal/src/fsfw_hal/linux/uio/UioMapper.cpp index b29ed63e4..6a7673e3e 100644 --- a/hal/src/fsfw_hal/linux/uio/UioMapper.cpp +++ b/hal/src/fsfw_hal/linux/uio/UioMapper.cpp @@ -22,7 +22,7 @@ ReturnValue_t UioMapper::getMappedAdress(uint32_t** address, Permissions permiss int fd = open(uioFile.c_str(), O_RDWR); if (fd < 1) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "PtmeAxiConfig::initialize: Invalid UIO device file" << std::endl; + sif::error << "PtmeAxiConfig::initialize: Invalid UIO device file" << std::endl; #endif return HasReturnvaluesIF::RETURN_FAILED; } @@ -36,7 +36,7 @@ ReturnValue_t UioMapper::getMappedAdress(uint32_t** address, Permissions permiss if (*address == MAP_FAILED) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "UioMapper::getMappedAdress: Failed to map physical address of uio device " + sif::error << "UioMapper::getMappedAdress: Failed to map physical address of uio device " << uioFile.c_str() << " and map" << static_cast(mapNum) << std::endl; #endif return HasReturnvaluesIF::RETURN_FAILED; @@ -52,19 +52,21 @@ ReturnValue_t UioMapper::getMapSize(size_t* size) { fp = fopen(namestream.str().c_str(), "r"); if (fp == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "UioMapper::getMapSize: Failed to open file " << namestream.str() << std::endl; + sif::error << "UioMapper::getMapSize: Failed to open file " << namestream.str() << std::endl; #endif + fclose(fp); return HasReturnvaluesIF::RETURN_FAILED; } char hexstring[SIZE_HEX_STRING] = ""; int items = fscanf(fp, "%s", hexstring); if (items != 1) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "UioMapper::getMapSize: Failed with error code " << errno + sif::error << "UioMapper::getMapSize: Failed with error code " << errno << " to read size " "string from file " << namestream.str() << std::endl; #endif + fclose(fp); return HasReturnvaluesIF::RETURN_FAILED; } uint32_t sizeTmp = 0; @@ -74,9 +76,10 @@ ReturnValue_t UioMapper::getMapSize(size_t* size) { } if (items != 1) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "UioMapper::getMapSize: Failed with error code " << errno << "to convert " + sif::error << "UioMapper::getMapSize: Failed with error code " << errno << "to convert " << "size of map" << mapNum << " to integer" << std::endl; #endif + fclose(fp); return HasReturnvaluesIF::RETURN_FAILED; } fclose(fp);