From: weyou Date: Mon, 18 Jun 2018 09:32:47 +0000 (+0800) Subject: Fixed the rrd file write mode on Windows X-Git-Tag: v1.7.1~58^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7d03cfe1e7ae7779d54915f90532bf448d36dc83;p=thirdparty%2Frrdtool-1.x.git Fixed the rrd file write mode on Windows --- diff --git a/src/mkstemp.c b/src/mkstemp.c index 4bb8ae98..ab6548e2 100644 --- a/src/mkstemp.c +++ b/src/mkstemp.c @@ -11,7 +11,6 @@ #include "rrd_tool.h" #include - static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; @@ -94,10 +93,13 @@ mkstemp (char *tmpl) #define _O_EXCL 0x0400 #define O_EXCL _O_EXCL +#ifndef O_BINARY +#define O_BINARY 0 +#endif #define _S_IREAD 0000400 /* read permission, owner */ #define _S_IWRITE 0000200 /* write permission, owner */ - fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL, _S_IREAD | _S_IWRITE); + fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL | O_BINARY, _S_IREAD | _S_IWRITE); if (fd >= 0) { errno = save_errno;