未验证 提交 1f003739 编写于 作者: wafwerar's avatar wafwerar 提交者: GitHub

[TD-345]<fix>(other): win taosd start error. (#9512)

上级 c77b844d
......@@ -433,7 +433,7 @@ int32_t readFromFile(char *name, uint32_t *len, void **buf) {
return TSDB_CODE_TSC_OUT_OF_MEMORY;
}
int fd = open(name, O_RDONLY);
int fd = open(name, O_RDONLY | O_BINARY);
if (fd < 0) {
tscError("open file %s failed, error:%s", name, strerror(errno));
tfree(*buf);
......
......@@ -240,7 +240,7 @@ static void dnodeCheckDataDirOpenned(char *dir) {
char filepath[256] = {0};
sprintf(filepath, "%s/.running", dir);
int fd = open(filepath, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU | S_IRWXG | S_IRWXO);
int fd = open(filepath, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRWXU | S_IRWXG | S_IRWXO);
if (fd < 0) {
dError("failed to open lock file:%s, reason: %s, quit", filepath, strerror(errno));
exit(0);
......
......@@ -266,7 +266,7 @@ static void* telemetryThread(void* param) {
}
static void dnodeGetEmail(char* filepath) {
int32_t fd = open(filepath, O_RDONLY);
int32_t fd = open(filepath, O_RDONLY | O_BINARY);
if (fd < 0) {
return;
}
......
......@@ -70,7 +70,7 @@ typedef struct {
#define TFILE_NAME(pf) ((pf)->aname)
#define TFILE_REL_NAME(pf) ((pf)->rname)
#define tfsopen(pf, flags) open(TFILE_NAME(pf), flags)
#define tfsopen(pf, flags) open(TFILE_NAME(pf), flags | O_BINARY)
#define tfsclose(fd) close(fd)
#define tfsremove(pf) remove(TFILE_NAME(pf))
#define tfscopy(sf, df) taosCopy(TFILE_NAME(sf), TFILE_NAME(df))
......
......@@ -22,7 +22,7 @@ uint32_t taosSafeRand(void) {
int fd;
int seed;
fd = open("/dev/urandom", 0);
fd = open("/dev/urandom", 0 | O_BINARY);
if (fd < 0) {
seed = (int)time(0);
} else {
......
......@@ -713,7 +713,7 @@ bool taosGetSystemUid(char *uid) {
int fd;
int len = 0;
fd = open("/proc/sys/kernel/random/uuid", 0);
fd = open("/proc/sys/kernel/random/uuid", 0 | O_BINARY);
if (fd < 0) {
return false;
} else {
......
......@@ -72,7 +72,7 @@ char* taosGetCmdlineByPID(int pid) {
static char cmdline[1024];
sprintf(cmdline, "/proc/%d/cmdline", pid);
int fd = open(cmdline, O_RDONLY);
int fd = open(cmdline, O_RDONLY | O_BINARY);
if (fd >= 0) {
int n = read(fd, cmdline, sizeof(cmdline) - 1);
if (n < 0) n = 0;
......
......@@ -172,7 +172,7 @@ int main(int argc, char *argv[]) {
tInfo("RPC server is running, ctrl-c to exit");
if (commit) {
dataFd = open(dataName, O_APPEND | O_CREAT | O_WRONLY, S_IRWXU | S_IRWXG | S_IRWXO);
dataFd = open(dataName, O_APPEND | O_CREAT | O_WRONLY | O_BINARY, S_IRWXU | S_IRWXG | S_IRWXO);
if (dataFd<0)
tInfo("failed to open data file, reason:%s", strerror(errno));
}
......
......@@ -43,7 +43,7 @@ int writeIntoWal(SWalHead *pHead) {
char walName[280];
snprintf(walName, sizeof(walName), "%s/wal/wal.%d", path, walNum);
(void)remove(walName);
dataFd = open(walName, O_CREAT | O_WRONLY, S_IRWXU | S_IRWXG | S_IRWXO);
dataFd = open(walName, O_CREAT | O_WRONLY | O_BINARY, S_IRWXU | S_IRWXG | S_IRWXO);
if (dataFd < 0) {
uInfo("failed to open wal file:%s(%s)", walName, strerror(errno));
return -1;
......
......@@ -498,7 +498,11 @@ static int tfsFormatDir(char *idir, char *odir) {
}
char tmp[PATH_MAX] = {0};
#ifdef WINDOWS
if (_fullpath(tmp,wep.we_wordv[0], PATH_MAX) == NULL) {
#else
if (realpath(wep.we_wordv[0], tmp) == NULL) {
#endif
terrno = TAOS_SYSTEM_ERROR(errno);
wordfree(&wep);
return -1;
......
......@@ -89,7 +89,7 @@ static FORCE_INLINE void tsdbSetMFileInfo(SMFile* pMFile, SMFInfo* pInfo) { pMFi
static FORCE_INLINE int tsdbOpenMFile(SMFile* pMFile, int flags) {
ASSERT(TSDB_FILE_CLOSED(pMFile));
pMFile->fd = open(TSDB_FILE_FULL_NAME(pMFile), flags);
pMFile->fd = open(TSDB_FILE_FULL_NAME(pMFile), flags | O_BINARY);
if (pMFile->fd < 0) {
terrno = TAOS_SYSTEM_ERROR(errno);
return -1;
......@@ -204,7 +204,7 @@ static FORCE_INLINE void tsdbSetDFileInfo(SDFile* pDFile, SDFInfo* pInfo) { pDFi
static FORCE_INLINE int tsdbOpenDFile(SDFile* pDFile, int flags) {
ASSERT(!TSDB_FILE_OPENED(pDFile));
pDFile->fd = open(TSDB_FILE_FULL_NAME(pDFile), flags);
pDFile->fd = open(TSDB_FILE_FULL_NAME(pDFile), flags | O_BINARY);
if (pDFile->fd < 0) {
terrno = TAOS_SYSTEM_ERROR(errno);
return -1;
......
......@@ -191,7 +191,7 @@ static void *taosThreadToOpenNewFile(void *param) {
umask(0);
int32_t fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU | S_IRWXG | S_IRWXO);
int32_t fd = open(name, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRWXU | S_IRWXG | S_IRWXO);
if (fd < 0) {
tsLogObj.openInProgress = 0;
tsLogObj.lines = tsLogObj.maxLines - 1000;
......@@ -252,7 +252,7 @@ void taosResetLog() {
}
static bool taosCheckFileIsOpen(char *logFileName) {
int32_t fd = open(logFileName, O_WRONLY, S_IRWXU | S_IRWXG | S_IRWXO);
int32_t fd = open(logFileName, O_WRONLY, S_IRWXU | S_IRWXG | S_IRWXO | O_BINARY);
if (fd < 0) {
if (errno == ENOENT) {
return false;
......@@ -340,7 +340,7 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) {
pthread_mutex_init(&tsLogObj.logMutex, NULL);
umask(0);
tsLogObj.logHandle->fd = open(fileName, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
tsLogObj.logHandle->fd = open(fileName, O_WRONLY | O_CREAT | O_BINARY, S_IRWXU | S_IRWXG | S_IRWXO);
if (tsLogObj.logHandle->fd < 0) {
printf("\nfailed to open log file:%s, reason:%s\n", fileName, strerror(errno));
......
......@@ -92,7 +92,7 @@ static void *taosThreadToOpenNewNote(void *param) {
umask(0);
int32_t fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU | S_IRWXG | S_IRWXO);
int32_t fd = open(name, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRWXU | S_IRWXG | S_IRWXO);
if (fd < 0) {
return NULL;
}
......@@ -132,7 +132,7 @@ static int32_t taosOpenNewNote(SNoteObj *pNote) {
}
static bool taosCheckNoteIsOpen(char *noteName, SNoteObj *pNote) {
int32_t fd = open(noteName, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
int32_t fd = open(noteName, O_WRONLY | O_CREAT | O_BINARY, S_IRWXU | S_IRWXG | S_IRWXO);
if (fd < 0) {
fprintf(stderr, "failed to open note:%s reason:%s\n", noteName, strerror(errno));
return true;
......@@ -207,7 +207,7 @@ static int32_t taosOpenNoteWithMaxLines(char *fn, int32_t maxLines, int32_t maxN
pthread_mutex_init(&pNote->mutex, NULL);
umask(0);
pNote->fd = open(noteName, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
pNote->fd = open(noteName, O_WRONLY | O_CREAT | O_BINARY, S_IRWXU | S_IRWXG | S_IRWXO);
if (pNote->fd < 0) {
fprintf(stderr, "failed to open note file:%s reason:%s\n", noteName, strerror(errno));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册