Blob Blame Raw
diff -up open-iscsi-2.0-870-rc1/usr/idbm.c.error open-iscsi-2.0-870-rc1/usr/idbm.c
--- open-iscsi-2.0-870-rc1/usr/idbm.c.error	2008-09-30 10:09:40.000000000 +0200
+++ open-iscsi-2.0-870-rc1/usr/idbm.c	2008-09-30 10:20:43.000000000 +0200
@@ -850,6 +850,12 @@ int idbm_lock(void)
 		if (ret == 0)
 			break;
 
+		if (errno != EEXIST) {
+			log_error("Could not lock discovery DB: %s: %s",
+					LOCK_WRITE_FILE, strerror(errno));
+			exit(-1);
+		}
+
 		usleep(10000);
 	}
 
diff -up open-iscsi-2.0-870-rc1/usr/iscsiadm.c.error open-iscsi-2.0-870-rc1/usr/iscsiadm.c
--- open-iscsi-2.0-870-rc1/usr/iscsiadm.c.error	2008-09-30 10:20:15.000000000 +0200
+++ open-iscsi-2.0-870-rc1/usr/iscsiadm.c	2008-09-30 10:20:15.000000000 +0200
@@ -2141,6 +2141,12 @@ main(int argc, char **argv)
 	if (mode < 0)
 		usage(0);
 
+	if (getuid()) {
+		log_error("must be run as root");
+		rc = -1;
+		goto free_ifaces;
+	}
+
 	if (mode == MODE_FW) {
 		if ((rc = verify_mode_params(argc, argv, "ml", 0))) {
 			log_error("fw mode: option '-%c' is not "