提交 ff367b50 编写于 作者: J jonathan pickett

fdapi not properly mapping fstat in config.c, so we ended up invoking CRT...

fdapi not properly mapping fstat in config.c, so we ended up invoking CRT version without the rfd->fd translation resulting in the CRT calling exit(). Fixes issue 43.
上级 a7f2df70
......@@ -228,6 +228,9 @@ int FDAPI_UpdateAcceptContext( int fd );
#define close(fd) fdapi_close(fd)
#define setmode(fd,mode) fdapi_setmode(fd,mode)
#define _get_osfhandle(fd) fdapi_get_osfhandle(fd)
#define _INC_STAT_INL
#define fstat(_Desc, _Stat) fdapi_fstat64(_Desc,_Stat)
#endif
#ifdef __cplusplus
......
......@@ -26,6 +26,7 @@
#include <stdio.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <windows.h>
#include <float.h>
#include <fcntl.h> /* _O_BINARY */
......
......@@ -1622,13 +1622,17 @@ int rewriteConfigOverwriteFile(char *configfile, sds content) {
int retval = 0;
int fd = open(configfile,O_RDWR|O_CREAT,0644);
int content_size = sdslen(content), padding = 0;
struct stat sb;
#ifdef _WIN32
struct _stat64 sb;
#else
struct stat sb;
#endif
sds content_padded;
/* 1) Open the old file (or create a new one if it does not
* exist), get the size. */
if (fd == -1) return -1; /* errno set by open(). */
if (fstat(fd,&sb) == -1) {
if (fstat(fd,&sb) == -1) {
close(fd);
return -1; /* errno set by fstat(). */
}
......
......@@ -1091,7 +1091,11 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) {
/* Mark that we are loading in the global state and setup the fields
* needed to provide loading stats. */
void startLoading(FILE *fp) {
struct stat sb;
#ifdef _WIN32
struct _stat64 sb;
#else
struct stat sb;
#endif
/* Load the DB */
server.loading = 1;
......
......@@ -758,10 +758,11 @@ int main(int argc, char **argv) {
int fd;
#ifdef _WIN32
off size;
struct _stat64 stat;
#else
off_t size;
struct stat stat;
#endif
struct stat stat;
void *data;
/* expect the first argument to be the dump file */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册