From 6beb479b3918fac694fbf4cdd22e5943ec3f0648 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 11 Sep 1996 23:22:25 +0000 Subject: [PATCH] Force O_BINARY in flags if defined, for e.g. Microsoft platforms. --- Modules/bsddbmodule.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Modules/bsddbmodule.c b/Modules/bsddbmodule.c index 1a82bd7a4f8..dd71005a8b1 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);