This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

Patch for nss/makedb.c



dbopen was called in makedb as:
  db_file = dbopen (output_name, DB_CREATE | db_truncate, mode);
But db_truncate gets initialized by load_db which is called by
dbopen.  We have to call load_db before calling dbopen.

The patch is untested.  I extracted it from my db-3.0.x support.

Andreas

2000-01-07  Andreas Jaeger  <aj@suse.de>

	* nss/makedb.c (main): Load database early to initialize version
	dependend variables.
	(dbopen): Don't load database here.

============================================================
Index: nss/makedb.c
--- nss/makedb.c	2000/01/04 17:48:13	1.3
+++ nss/makedb.c	2000/01/07 11:32:55
@@ -154,6 +154,14 @@
       output_name = argv[remaining];
     }
 
+  /* First load the shared object to initialize version dependend
+     variables.  */
+  load_db ();
+
+  if (db_open == NULL)
+    error (EXIT_FAILURE, 0, gettext ("No usable database library found."));
+  
+  
   /* Special handling if we are asked to print the database.  */
   if (do_undo)
     {
@@ -518,12 +526,6 @@
   int err;
   void *odb;
   NSS_DB *db;
-
-  /* First load the shared object.  */
-  load_db ();
-
-  if (db_open == NULL)
-    return NULL;
 
   /* Actually open the database.  */
   err = DL_CALL_FCT (db_open, (fname, DB_BTREE, oper, mode, NULL, NULL, &odb));

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.rhein-neckar.de

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