Force O_BINARY in flags if defined, for e.g. Microsoft platforms.

This commit is contained in:
Guido van Rossum 1996-09-11 23:22:25 +00:00
parent 622f577eac
commit 6beb479b39
1 changed files with 10 additions and 1 deletions

View File

@ -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);
@ -119,6 +122,9 @@ newdbbtobject(file, flags, mode,
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);