summaryrefslogtreecommitdiffstats
path: root/Modules/bsddbmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-09-11 23:22:25 (GMT)
committerGuido van Rossum <guido@python.org>1996-09-11 23:22:25 (GMT)
commit6beb479b3918fac694fbf4cdd22e5943ec3f0648 (patch)
treeb1ae23c1835a06b5af5359324ec274b8fb6fcf74 /Modules/bsddbmodule.c
parent622f577eacd8ac8a0d8699665360e2d2b79d9eb7 (diff)
downloadcpython-6beb479b3918fac694fbf4cdd22e5943ec3f0648.zip
cpython-6beb479b3918fac694fbf4cdd22e5943ec3f0648.tar.gz
cpython-6beb479b3918fac694fbf4cdd22e5943ec3f0648.tar.bz2
Force O_BINARY in flags if defined, for e.g. Microsoft platforms.
Diffstat (limited to 'Modules/bsddbmodule.c')
-rw-r--r--Modules/bsddbmodule.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/Modules/bsddbmodule.c b/Modules/bsddbmodule.c
index 1a82bd7..dd71005 100644
--- a/Modules/bsddbmodule.c
+++ b/Modules/bsddbmodule.c
@@ -80,6 +80,9 @@ newdbhashobject(file, flags, mode,
info.hash = NULL; /* XXX should derive from hash argument */
info.lorder = lorder;
+#ifdef O_BINARY
+ flags |= O_BINARY;
+#endif
if ((dp->di_bsddb = dbopen(file, flags, mode, DB_HASH, &info)) == NULL) {
PyErr_SetFromErrno(BsddbError);
Py_DECREF(dp);
@@ -116,9 +119,12 @@ newdbbtobject(file, flags, mode,
info.minkeypage = minkeypage;
info.psize = psize;
info.lorder = lorder;
- info.compare = 0; /* Use default comparison functions, for now..*/
+ info.compare = 0; /* Use default comparison functions, for now..*/
info.prefix = 0;
+#ifdef O_BINARY
+ flags |= O_BINARY;
+#endif
if ((dp->di_bsddb = dbopen(file, flags, mode, DB_BTREE, &info)) == NULL) {
PyErr_SetFromErrno(BsddbError);
Py_DECREF(dp);
@@ -158,6 +164,9 @@ newdbrnobject(file, flags, mode,
info.bval = bval;
info.bfname = bfname;
+#ifdef O_BINARY
+ flags |= O_BINARY;
+#endif
if ((dp->di_bsddb = dbopen(file, flags, mode, DB_RECNO, &info)) == NULL) {
PyErr_SetFromErrno(BsddbError);
Py_DECREF(dp);