hal/hald util.c,1.11,1.12

David Zeuthen david at freedesktop.org
Tue Mar 15 18:58:04 PST 2005


Update of /cvs/hal/hal/hald
In directory gabe:/tmp/cvs-serv22445/hald

Modified Files:
	util.c 
Log Message:
2005-03-15  David Zeuthen  <davidz at redhat.com>

	* hald/util.c (hal_util_get_string_from_file): Yikes, variable i
	needs to be a gint rather than an guint otherwise our for-loop
	with i >= 0 will continue with i < 0 (only seen on x86_64 with
	gcc4)

	* hald/linux2/classdev.c (serial_add): Also make an unsigned int
	an int cf. above comment



Index: util.c
===================================================================
RCS file: /cvs/hal/hal/hald/util.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- util.c	10 Mar 2005 19:44:11 -0000	1.11
+++ util.c	16 Mar 2005 02:58:02 -0000	1.12
@@ -339,7 +339,7 @@
 	gchar path[HAL_PATH_MAX];
 	gchar *result;
 	gsize len;
-	guint i;
+	gint i;
 	
 	f = NULL;
 	result = NULL;
@@ -352,6 +352,7 @@
 		goto out;
 	}
 
+	buf[0] = '\0';
 	if (fgets (buf, sizeof (buf), f) == NULL) {
 		HAL_ERROR (("Cannot read from '%s'", path));
 		goto out;
@@ -362,7 +363,7 @@
 		buf[len-1] = '\0';
 
 	/* Clear remaining whitespace */
-	for (i = len-2; i >= 0; --i) {
+	for (i = len - 2; i >= 0; --i) {
 		if (!g_ascii_isspace (buf[i]))
 			break;
 		buf[i] = '\0';




More information about the hal-commit mailing list