Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <20020213233512.97499.qmail@web21204.mail.yahoo.com> Date: Wed, 13 Feb 2002 15:35:12 -0800 (PST) From: AJ Reins Subject: Possible patch for gdbm To: cygwin AT cygwin DOT com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii diff -urN gdbm-1.8.0.old/gdbmopen.c gdbm-1.8.0/gdbmopen.c --- gdbm-1.8.0.old/gdbmopen.c Sat Jul 29 22:46:42 2000 +++ gdbm-1.8.0/gdbmopen.c Thu Feb 7 09:25:48 2002 @@ -126,21 +126,21 @@ switch (flags & GDBM_OPENMASK) { case GDBM_READER: - dbf->desc = open (dbf->name, O_RDONLY, 00444 ); /* umask will restrict this */ + dbf->desc = open (dbf->name, O_RDONLY|O_BINARY, 00444 ); /* umask will restrict this */ break; case GDBM_OPENMASK: - dbf->desc = open (dbf->name, O_RDWR, 00666 ); /* umask will restrict this */ + dbf->desc = open (dbf->name, O_RDWR|O_BINARY, 00666 ); /* umask will restrict this */ break; case GDBM_NEWDB: - dbf->desc = open (dbf->name, O_RDWR|O_CREAT, mode); + dbf->desc = open (dbf->name, O_RDWR|O_CREAT|O_BINARY, mode); flags = GDBM_WRITER; need_trunc = TRUE; break; default: - dbf->desc = open (dbf->name, O_RDWR|O_CREAT, mode); + dbf->desc = open (dbf->name, O_RDWR|O_CREAT|O_BINARY, mode); flags = GDBM_WRITER; break; diff -urN gdbm-1.8.0.old/systems.h gdbm-1.8.0/systems.h --- gdbm-1.8.0.old/systems.h Sat Jul 29 22:46:42 2000 +++ gdbm-1.8.0/systems.h Thu Feb 7 09:31:50 2002 @@ -136,11 +136,16 @@ #define STATBLKSIZE 1024 #endif +/* Paranoia never hurt, too much that is */ +#ifndef O_BINARY +#define O_BINARY 0 +#endif + /* Do we have ftruncate? */ #if HAVE_FTRUNCATE #define TRUNCATE(dbf) ftruncate (dbf->desc, 0) #else -#define TRUNCATE(dbf) close( open (dbf->name, O_RDWR|O_TRUNC, mode)); +#define TRUNCATE(dbf) close( open (dbf->name, O_RDWR|O_TRUNC|O_BINARY, mode)); #endif #ifndef STDERR_FILENO __________________________________________________ Do You Yahoo!? Send FREE Valentine eCards with Yahoo! Greetings! http://greetings.yahoo.com -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/