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