This is a quick patch to try and resolve the issue of IDBM file corruption. Signed-off-by: Robin H. Johnson diff -NuarbB --exclude .svn --exclude '*~' open-iscsi-0.4-438/usr/idbm.c open-iscsi/usr/idbm.c --- open-iscsi-0.4-438/usr/idbm.c 2005-10-18 13:10:39.000000000 -0700 +++ open-iscsi/usr/idbm.c 2005-11-04 16:14:31.000000000 -0800 @@ -1481,14 +1481,14 @@ if ((db->discdb = idbm_open(DISCOVERY_FILE, access(DISCOVERY_FILE, F_OK) != 0 ? - O_CREAT|O_RDWR : O_RDWR)) == NULL) { + O_CREAT|O_RDWR|O_EXCL : O_RDWR|O_EXCL)) == NULL) { free(db->configfile); free(db); return NULL; } if ((db->nodedb = idbm_open(NODE_FILE, access(NODE_FILE, F_OK) != 0 ? - O_CREAT|O_RDWR : O_RDWR)) == NULL) { + O_CREAT|O_RDWR|O_EXCL : O_RDWR|O_EXCL)) == NULL) { idbm_close(db->discdb); free(db->configfile); free(db);