浏览代码

HPCC-16271 Dafilesrv copyfile exception crash

Signed-off-by: Mark Kelly <mark.kelly@lexisnexis.com>
Mark Kelly 8 年之前
父节点
当前提交
ac6be63b64
共有 1 个文件被更改,包括 6 次插入5 次删除
  1. 6 5
      common/remote/sockfile.cpp

+ 6 - 5
common/remote/sockfile.cpp

@@ -363,7 +363,7 @@ const char *RFCStrings[] =
     RFCText(RFCsetfileperms),
     RFCText(RFCsetfileperms),
     RFCText(RFCunknown),
     RFCText(RFCunknown),
 };
 };
-static const char *getRFCText(unsigned cmd)
+static const char *getRFCText(RemoteFileCommandType cmd)
 {
 {
     if (cmd > RFCmax)
     if (cmd > RFCmax)
         cmd = RFCmax;
         cmd = RFCmax;
@@ -2984,15 +2984,16 @@ inline void appendErr3(MemoryBuffer &reply, unsigned e, int code, const char *er
     reply.append(e);
     reply.append(e);
     reply.append(msg.str());
     reply.append(msg.str());
 }
 }
-inline void appendCmdErr(MemoryBuffer &reply, unsigned e, int code, const char *errMsg)
+inline void appendCmdErr(MemoryBuffer &reply, RemoteFileCommandType e, int code, const char *errMsg)
 {
 {
     StringBuffer msg;
     StringBuffer msg;
     msg.appendf("ERROR: %s(%d) '%s'", getRFCText(e), code, errMsg?errMsg:"");
     msg.appendf("ERROR: %s(%d) '%s'", getRFCText(e), code, errMsg?errMsg:"");
     // RFCOpenIO needs remapping to non-zero for client to know its an error
     // RFCOpenIO needs remapping to non-zero for client to know its an error
     // perhaps we should use code here instead of e ?
     // perhaps we should use code here instead of e ?
-    if ((RemoteFileCommandType)e == RFCopenIO)
-        e = RFSERR_OpenFailed;
-    reply.append(e);
+    unsigned err = e;
+    if ((RemoteFileCommandType)err == RFCopenIO)
+        err = RFSERR_OpenFailed;
+    reply.append(err);
     reply.append(msg.str());
     reply.append(msg.str());
 }
 }