This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Possible patch for gdbm


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]