Hi all,

Ubuntu 8.10 has a newer version of the standard library that causes the
compiler to issue warnings for unchecked return values for some calls.
The attached patch fixes two such issues.

Cheers,

Zach
Index: src/helper/jim.c
===================================================================
--- src/helper/jim.c	(revision 1478)
+++ src/helper/jim.c	(working copy)
@@ -133,7 +133,8 @@
 	buf[sizeof(buf)-1] = 0;
 #else
 	char *buf;
-	vasprintf( &buf, fmt, ap );
+	int result = vasprintf( &buf, fmt, ap );
+	if (result < 0) exit(-1);
 #endif
 	return buf;
 }
@@ -8953,7 +8954,8 @@
     	const int cwd_len=2048;
 		char *cwd=malloc(cwd_len);
         Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
-	getcwd( cwd, cwd_len );
+	cwd = getcwd( cwd, cwd_len );
+	if (NULL == cwd) strcpy(cwd, "unknown");
         Jim_AppendStrings(interp, Jim_GetResult(interp),
 	"Error loading script \"", filename, "\"",
 	    " cwd: ", cwd,
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to