Closed as not planned
Description
Description of the issue
This is test code:
test_throw.h
#define _O_RDONLY 0x0000 // open for reading only
namespace OCKIO {
namespace MSG {
void Throw(const char* func, const char* file)
{
throw("error");
}
}
};
test_throw.cpp
#include "test_throw.h"
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
namespace OCKIO {
namespace SHORE {
namespace PROCESSOR {
class TransPosix {
private:
void ReadJewel();
};
void TransPosix::ReadJewel(){
auto fdData = open("a.txt", 0x0000);
if (fdData < 0) {
MSG::Throw("error", "file opening failed");
}
if (lseek(fdData, 5, SEEK_SET) > 20){
// no close
**MSG::Throw("error", "file opening failed");**
}
close(fdData);
}
}
}
};
How can I check fdData is closed, before throw?