public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* Patch for nss/makedb.c
@ 2000-01-07  3:40 Andreas Jaeger
  0 siblings, 0 replies; only message in thread
From: Andreas Jaeger @ 2000-01-07  3:40 UTC (permalink / raw)
  To: GNU libc hacker

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-01-07  3:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-07  3:40 Patch for nss/makedb.c Andreas Jaeger

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).