printout fixes for UnixFileGuard
This commit is contained in:
parent
d92a796705
commit
845c00044e
@ -1,5 +1,10 @@
|
|||||||
|
#include "fsfw/FSFW.h"
|
||||||
|
#include "fsfw/serviceinterface.h"
|
||||||
#include "fsfw_hal/linux/UnixFileGuard.h"
|
#include "fsfw_hal/linux/UnixFileGuard.h"
|
||||||
|
|
||||||
|
#include <cerrno>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
UnixFileGuard::UnixFileGuard(std::string device, int* fileDescriptor, int flags,
|
UnixFileGuard::UnixFileGuard(std::string device, int* fileDescriptor, int flags,
|
||||||
std::string diagnosticPrefix):
|
std::string diagnosticPrefix):
|
||||||
fileDescriptor(fileDescriptor) {
|
fileDescriptor(fileDescriptor) {
|
||||||
@ -10,12 +15,11 @@ UnixFileGuard::UnixFileGuard(std::string device, int* fileDescriptor, int flags,
|
|||||||
if (*fileDescriptor < 0) {
|
if (*fileDescriptor < 0) {
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << diagnosticPrefix <<"Opening device failed with error code " << errno <<
|
sif::warning << diagnosticPrefix << "Opening device failed with error code " <<
|
||||||
"." << std::endl;
|
errno << ": " << strerror(errno) << std::endl;
|
||||||
sif::warning << "Error description: " << strerror(errno) << std::endl;
|
|
||||||
#else
|
#else
|
||||||
sif::printError("%sOpening device failed with error code %d.\n", diagnosticPrefix);
|
sif::printWarning("%sOpening device failed with error code %d: %s\n",
|
||||||
sif::printWarning("Error description: %s\n", strerror(errno));
|
diagnosticPrefix, errno, strerror(errno));
|
||||||
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
||||||
openStatus = OPEN_FILE_FAILED;
|
openStatus = OPEN_FILE_FAILED;
|
||||||
|
Loading…
Reference in New Issue
Block a user