[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Broken libdb2?



   Date: Wed, 9 Jun 1999 17:20:51 +0200
   From: Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>

   On Wed, Jun 09, 1999 at 05:20:48PM +0200, Per Lundberg wrote:
   > 
   > > maybe you want to apply the same changes to the standalone db packages?
   > > You're certainly welcome.
   > 
   > What do mean is the problem in the db packages? AFAIK the dbopen() is a
   > glibc call, and should be fixed in glibc.. but I could be wrong.

   Ah, no, it may well be that you are correct and me is not. I didn't
   look that closely as soon as Mark said he found the problem.

Roland checked in the following patch to libc:

1999-06-07  Roland McGrath  <roland@baalperazim.frob.com>

	* db2/os/os_oflags.c (__db_oflags): Fix checking of O_ACCMODE bits to
	be POSIX compliant.  Prior definition was broken for Hurd.
	Reported by Mark Kettenis <kettenis@gnu.org>.

Index: os_oflags.c
===================================================================
RCS file: /var/cvsroot/libc/db2/os/os_oflags.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 os_oflags.c
--- os_oflags.c	1999/05/22 14:51:08	1.1.1.1
+++ os_oflags.c	1999/06/09 21:01:52
@@ -33,16 +33,21 @@
 	u_int32_t dbflags;
 
 	/*
-	 * XXX
-	 * Convert POSIX 1003.1 open(2) flags to DB flags.  Not an exact
-	 * science as most POSIX implementations don't have a flag value
-	 * for O_RDONLY, it's simply the lack of a write flag.
+	 * Convert POSIX 1003.1 open(2) flags to DB flags.
 	 */
 	dbflags = 0;
+	switch (oflags & O_ACCMODE) {
+	case O_RDONLY:
+		dbflags |= DB_RDONLY;
+		break;
+	case O_WRONLY:
+	case O_RDWR:
+		break;
+	default:		/* Bogus flags value from user.  */
+	  /* XXX no way to return error from here */
+	}
 	if (oflags & O_CREAT)
 		dbflags |= DB_CREATE;
-	if (!(oflags & (O_RDWR | O_WRONLY)) || oflags & O_RDONLY)
-		dbflags |= DB_RDONLY;
 	if (oflags & O_TRUNC)
 		dbflags |= DB_TRUNCATE;
 	return (dbflags);


If debian has a seperate db2 package that is not based on the db2
sources in glibc, but on the upstream sources instead, this patch
should be applied there too.

Mark


Reply to: