Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion XEngine_Source/XEngine_StorageApp/StorageApp_UPLoader.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#include "StorageApp_Hdr.h"
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <stdio.h>

XHTHREAD XCALLBACK XEngine_UPLoader_HTTPThread(XPVOID lParam)
{
Expand Down Expand Up @@ -192,9 +196,20 @@ bool XEngine_Task_HttpUPLoader(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, in
return true;
}
//文件是否可写
FILE* pSt_File = _xtfopen(tszFileDir, _X("wb"));
int nFileFD = open(tszFileDir, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
if (nFileFD < 0)
{
st_HDRParam.bIsClose = true;
st_HDRParam.nHttpCode = 403;
HttpProtocol_Server_SendMsgEx(xhUPHttp, tszSDBuffer, &nSDLen, &st_HDRParam);
XEngine_Net_SendMsg(lpszClientAddr, tszSDBuffer, nSDLen, nNetType);
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("上传客户端:%s,准备上传文件:%s 失败,创建文件失败"), lpszClientAddr, tszFileDir);
return true;
}
FILE* pSt_File = fdopen(nFileFD, "wb");
if (NULL == pSt_File)
{
close(nFileFD);
st_HDRParam.bIsClose = true;
st_HDRParam.nHttpCode = 403;
HttpProtocol_Server_SendMsgEx(xhUPHttp, tszSDBuffer, &nSDLen, &st_HDRParam);
Expand Down