未验证 提交 98846d56 编写于 作者: M Minglei Jin 提交者: GitHub

Merge pull request #11945 from taosdata/fix/TS-1312-2.4

fix(query): fixed a query coredump in Windows
...@@ -179,7 +179,7 @@ int64_t taosFSendFile(FILE *out_file, FILE *in_file, int64_t *offset, int64_t co ...@@ -179,7 +179,7 @@ int64_t taosFSendFile(FILE *out_file, FILE *in_file, int64_t *offset, int64_t co
fwrite(buffer, 1, rlen, out_file); fwrite(buffer, 1, rlen, out_file);
return (int64_t)(writeLen + rlen); return (int64_t)(writeLen + rlen);
} else { } else {
fwrite(buffer, 1, _SEND_FILE_STEP_, in_file); fwrite(buffer, 1, _SEND_FILE_STEP_, out_file);
writeLen += _SEND_FILE_STEP_; writeLen += _SEND_FILE_STEP_;
} }
} }
...@@ -223,7 +223,7 @@ int64_t taosSendFile(SocketFd dfd, FileFd sfd, int64_t *offset, int64_t count) { ...@@ -223,7 +223,7 @@ int64_t taosSendFile(SocketFd dfd, FileFd sfd, int64_t *offset, int64_t count) {
if (rlen <= 0) { if (rlen <= 0) {
return writeLen; return writeLen;
} else { } else {
taosWriteSocket(sfd, buffer, (int32_t)remain); taosWriteSocket(dfd, buffer, (int32_t)remain);
writeLen += remain; writeLen += remain;
} }
} }
......
...@@ -126,6 +126,13 @@ STSBuf* tsBufCreateFromFile(const char* path, bool autoDelete) { ...@@ -126,6 +126,13 @@ STSBuf* tsBufCreateFromFile(const char* path, bool autoDelete) {
ret = fseek(pTSBuf->f, 0, SEEK_END); ret = fseek(pTSBuf->f, 0, SEEK_END);
UNUSED(ret); UNUSED(ret);
// file meta data may be cached, close and reopen the file for accurate file size.
fclose(pTSBuf->f);
pTSBuf->f = fopen(pTSBuf->path, "rb+");
if (pTSBuf->f == NULL) {
return pTSBuf;
}
struct stat fileStat; struct stat fileStat;
if (fstat(fileno(pTSBuf->f), &fileStat) != 0) { if (fstat(fileno(pTSBuf->f), &fileStat) != 0) {
tsBufDestroy(pTSBuf); tsBufDestroy(pTSBuf);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册