--- open-iscsi-2.0-707/usr/iscsiadm.c	2007/11/15 13:40:28	1.11
+++ open-iscsi-2.0-707/usr/iscsiadm.c	2007/11/30 08:00:53
@@ -1194,7 +1194,8 @@
 			strncpy(cfg.address, ip, sizeof(cfg.address));
 
 			cfg.port = port;
-			if (!do_sendtargets(db, &cfg) && do_login) {
+			rc = do_sendtargets(db, &cfg);
+			if (!rc && do_login) {
 				log_error("automatic login after discovery "
 					  "is not fully implemented yet.");
 				rc = -1;
@@ -1224,7 +1225,7 @@
 				}
 				if (do_login &&
 				    rec.type == DISCOVERY_TYPE_SENDTARGETS) {
-					do_sendtargets(db, &rec.u.sendtargets);
+					rc = do_sendtargets(db, &rec.u.sendtargets);
 				} else if (do_login &&
 					   rec.type == DISCOVERY_TYPE_SLP) {
 					log_error("SLP discovery is not fully "
@@ -1265,7 +1266,7 @@
 				}
 				if (do_login &&
 				    rec.type == DISCOVERY_TYPE_SENDTARGETS) {
-					do_sendtargets(db, &rec.u.sendtargets);
+					rc = do_sendtargets(db, &rec.u.sendtargets);
 				} else if (do_login &&
 					   rec.type == DISCOVERY_TYPE_SLP) {
 					log_error("SLP discovery is not fully "
