public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Possible patch for gdbm
@ 2002-02-13 15:35 AJ Reins
  2002-02-17  0:14 ` Charles Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: AJ Reins @ 2002-02-13 15:35 UTC (permalink / raw)
  To: cygwin

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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-02-17  8:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-13 15:35 Possible patch for gdbm AJ Reins
2002-02-17  0:14 ` Charles Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).