From: Jonathan McDowell <noodles@earth.li>
Date: Mon, 31 May 2004 23:48:05 +0000 (+0000)
Subject: cscvs to tla changeset 108
X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/commitdiff_plain/5da3ec5ecc3bb7621872bd647a1ab5e2323c023b?hp=58d762ea573eb3cfea626bb52ea7a99e24b8a0aa

cscvs to tla changeset 108
Author: noodles
Date: 2003/10/10 16:57:27
Create num_keydb if it doesn't exist.
---

diff --git a/keydb_db3.c b/keydb_db3.c
index 309a297..b3441b7 100644
--- a/keydb_db3.c
+++ b/keydb_db3.c
@@ -5,7 +5,7 @@
  *
  * Copyright 2002 Project Purple
  *
- * $Id: keydb_db3.c,v 1.21 2003/10/03 23:02:04 noodles Exp $
+ * $Id: keydb_db3.c,v 1.22 2003/10/10 16:57:27 noodles Exp $
  */
 
 #include <assert.h>
@@ -139,6 +139,15 @@ void initdb(void)
 	} else {
 		logthing(LOGTHING_ERROR, "Couldn't open num_keydb: %s",
 				strerror(errno));
+		numdb = fopen(buf, "w");
+		if (numdb != NULL) {
+			fprintf(numdb, "%d", numdbs);
+			fclose(numdb);
+		} else {
+			logthing(LOGTHING_ERROR,
+				"Couldn't write num_keydb: %s",
+				strerror(errno));
+		}
 	}
 
 	dbconns = malloc(sizeof (DB *) * numdbs);