Blob Blame History Raw
diff -up open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ppc.c.crash open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ppc.c
--- open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ppc.c.crash	2008-11-22 18:06:46.000000000 +0100
+++ open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ppc.c	2009-04-27 20:33:33.000000000 +0200
@@ -341,6 +341,7 @@ static int loop_devs(const char *devtree
 	int i;
 	char prefix[256];
 
+	nic_count = 0;
 	error = nftw(devtree, find_nics, 20, 0);
 	if (error)
 		return error;
@@ -352,6 +353,7 @@ static int loop_devs(const char *devtree
 	qsort(niclist, nic_count, sizeof(char *), nic_cmp);
 
 	snprintf(prefix, sizeof(prefix), "%s/%s", devtree, "aliases");
+	dev_count = 0;
 	error = nftw(prefix, find_initiator, 20, 0);
 	if (error)
 		return error;
@@ -366,8 +368,6 @@ static int loop_devs(const char *devtree
 
 		}
 	}
-	if (!error)
-		putchar('\n');
 	return error;
 }
 
@@ -425,7 +425,7 @@ static void fill_context(struct boot_con
 int fwparam_ppc(struct boot_context *context, const char *filepath)
 {
 	int error;
-	int fplen = 0;
+	int dev_count;
 	char *devtree;
 
 	/*
@@ -435,13 +435,10 @@ int fwparam_ppc(struct boot_context *con
 	 * systems that can support iscsi are the ones that provide
 	 * the appropriate FCODE with a load method.
 	 */
-	if (filepath) {
-		strncat(filename, filepath, FILENAMESZ);
-		fplen = strlen(filename);
-	} else
-		strncat(filename, DT_TOP, FILENAMESZ);
-
-	strncat(filename + fplen, BOOTPATH, FILENAMESZ - fplen);
+	if (filepath)  
+		snprintf(filename, FILENAMESZ, "%s%s", filepath, BOOTPATH);
+	else
+		snprintf(filename, FILENAMESZ, "%s%s", DT_TOP, BOOTPATH);
 
 	if (debug)
 		fprintf(stderr, "%s: file:%s; debug:%d\n", __func__, filename,