mchristi 2df40a
diff -aurp open-iscsi-6.2.0.695/usr/idbm.c open-iscsi-6.2.0.695.work/usr/idbm.c
mchristi 2df40a
--- open-iscsi-6.2.0.695/usr/idbm.c	2006-10-03 13:54:51.000000000 -0500
mchristi 2df40a
+++ open-iscsi-6.2.0.695.work/usr/idbm.c	2006-10-03 14:44:56.000000000 -0500
mchristi 2df40a
@@ -831,10 +831,18 @@ idbm_node_write(idbm_t *db, node_rec_t *
mchristi 2df40a
 
mchristi 2df40a
 	idbm_lock(db);
mchristi 2df40a
 
mchristi 2df40a
-	snprintf(portal, PATH_MAX, "%s", NODE_CONFIG_DIR);
mchristi 2df40a
-	if (access(portal, F_OK) != 0) {
mchristi 2df40a
+	/* bah: there has to be a function to make all these subdirs for us */
mchristi 2df40a
+	if (access(CONFIG_DIR, F_OK) != 0) {
mchristi 2df40a
 		if (mkdir(portal, 0660) != 0) {
mchristi 2df40a
-			log_error("Could not make %s\n", portal);
mchristi 2df40a
+			log_error("Could not make %s %d\n", CONFIG_DIR, errno);
mchristi 2df40a
+			rc = errno;
mchristi 2df40a
+			goto free_portal;
mchristi 2df40a
+		}
mchristi 2df40a
+	}
mchristi 2df40a
+
mchristi 2df40a
+	if (access(NODE_CONFIG_DIR, F_OK) != 0) {
mchristi 2df40a
+		if (mkdir(NODE_CONFIG_DIR, 0660) != 0) {
mchristi 2df40a
+			log_error("Could not make %s\n", NODE_CONFIG_DIR);
mchristi 2df40a
 			rc = errno;
mchristi 2df40a
 			goto free_portal;
mchristi 2df40a
 		}
mchristi 2df40a
@@ -869,6 +877,7 @@ free_portal:
mchristi 2df40a
 	return rc;
mchristi 2df40a
 }
mchristi 2df40a
 
mchristi 2df40a
+/* TODO: merged these two functions */
mchristi 2df40a
 static int
mchristi 2df40a
 idbm_discovery_write(idbm_t *db, discovery_rec_t *rec)
mchristi 2df40a
 {
mchristi 2df40a
@@ -883,10 +892,18 @@ idbm_discovery_write(idbm_t *db, discove
mchristi 2df40a
 	}
mchristi 2df40a
 
mchristi 2df40a
 	idbm_lock(db);
mchristi 2df40a
-	snprintf(portal, PATH_MAX, "%s", ST_CONFIG_DIR);
mchristi 2df40a
-	if (access(portal, F_OK) != 0) {
mchristi 2df40a
-		if (mkdir(portal, 0660) != 0) {
mchristi 2df40a
-			log_error("Could not make %s\n", portal);
mchristi 2df40a
+
mchristi 2df40a
+	if (access(CONFIG_DIR, F_OK) != 0) {
mchristi 2df40a
+		if (mkdir(CONFIG_DIR, 0660) != 0) {
mchristi 2df40a
+			log_error("Could not make %s %d\n", CONFIG_DIR, errno);
mchristi 2df40a
+			rc = errno;
mchristi 2df40a
+			goto free_portal;
mchristi 2df40a
+		}
mchristi 2df40a
+	}
mchristi 2df40a
+
mchristi 2df40a
+	if (access(ST_CONFIG_DIR, F_OK) != 0) {
mchristi 2df40a
+		if (mkdir(ST_CONFIG_DIR, 0660) != 0) {
mchristi 2df40a
+			log_error("Could not make %s\n", ST_CONFIG_DIR);
mchristi 2df40a
 			rc = errno;
mchristi 2df40a
 			goto free_portal;
mchristi 2df40a
 		}
mchristi 2df40a
diff -aurp open-iscsi-6.2.0.695/usr/initiator.h open-iscsi-6.2.0.695.work/usr/initiator.h
mchristi 2df40a
--- open-iscsi-6.2.0.695/usr/initiator.h	2006-10-03 13:54:51.000000000 -0500
mchristi 2df40a
+++ open-iscsi-6.2.0.695.work/usr/initiator.h	2006-10-03 14:08:09.000000000 -0500
mchristi 2df40a
@@ -31,11 +31,15 @@
mchristi 2df40a
 #include "actor.h"
mchristi 2df40a
 #include "queue.h"
mchristi 2df40a
 
mchristi 2df40a
-#define ST_CONFIG_DIR		"/etc/iscsi/send_targets"
mchristi 2df40a
-#define NODE_CONFIG_DIR		"/etc/iscsi/nodes"
mchristi 2df40a
+#define CONFIG_DIR		"/var/lib/iscsi"
mchristi 2df40a
+#define ST_CONFIG_DIR		"/var/lib/iscsi/send_targets"
mchristi 2df40a
+#define NODE_CONFIG_DIR		"/var/lib/iscsi/nodes"
mchristi 2df40a
+
mchristi 2df40a
 #define CONFIG_FILE		"/etc/iscsi/iscsid.conf"
mchristi 2df40a
-#define PID_FILE		"/var/run/iscsid.pid"
mchristi 2df40a
 #define INITIATOR_NAME_FILE	"/etc/iscsi/initiatorname.iscsi"
mchristi 2df40a
+
mchristi 2df40a
+#define PID_FILE		"/var/run/iscsid.pid"
mchristi 2df40a
+
mchristi 2df40a
 #define LOCK_DIR		"/var/lock/iscsi"
mchristi 2df40a
 #define LOCK_FILE		"/var/lock/iscsi/lock"
mchristi 2df40a
 #define LOCK_WRITE_FILE		"/var/lock/iscsi/lock.write"