Skip to content

Commit

Permalink
Merge pull request #51 from Toilal/access-denied-file-handle
Browse files Browse the repository at this point in the history
Display exception message when failing process request
  • Loading branch information
marcharding authored Nov 13, 2017
2 parents 4669b59 + 243a65f commit 4b770d7
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/NFS3Prog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ int CNFS3Prog::Process(IInputStream *pInStream, IOutputStream *pOutStream, Proce
&CNFS3Prog::ProcedureCOMMIT
};

nfsstat3 stat;
nfsstat3 stat = NULL;

struct tm current;
time_t now;
Expand All @@ -253,15 +253,22 @@ int CNFS3Prog::Process(IInputStream *pInStream, IOutputStream *pOutStream, Proce

try {
stat = (this->*pf[pParam->nProc])();
} catch (const std::runtime_error& re) {
m_nResult = PRC_FAIL;
PrintLog("Runtime error: ");
PrintLog(re.what());
} catch (const std::exception& ex) {
m_nResult = PRC_FAIL;
PrintLog("Exception: ");
PrintLog(ex.what());
} catch (...) {
m_nResult = PRC_FAIL;
PrintLog("Unknown failure: Possible memory corruption");
}

PrintLog(" ");

if (m_nResult == PRC_FAIL) { //input data is truncated
PrintLog("fail");
} else {
if (stat != NULL) {
switch (stat) {
case NFS3_OK:
PrintLog("OK");
Expand Down

0 comments on commit 4b770d7

Please sign in to comment.