]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Fixed the rrd file write mode on Windows
authorweyou <weyou.dev@gmail.com>
Mon, 18 Jun 2018 09:32:47 +0000 (17:32 +0800)
committerweyou <weyou.dev@gmail.com>
Mon, 18 Jun 2018 09:32:47 +0000 (17:32 +0800)
src/mkstemp.c

index 4bb8ae980e40e6038ffc81eb3cb2bd35fe077f79..ab6548e22868a8e413104fc41a084bb21e96bbd6 100644 (file)
@@ -11,7 +11,6 @@
 #include "rrd_tool.h"
 #include <fcntl.h>
 
-
 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;