gnome-panel r11471 - trunk/applets/fish



Author: vuntz
Date: Fri Jan 23 17:25:36 2009
New Revision: 11471
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=11471&view=rev

Log:
2009-01-23  Vincent Untz  <vuntz gnome org>

	* fish.c: (get_location): fix some more warnings.


Modified:
   trunk/applets/fish/ChangeLog
   trunk/applets/fish/fish.c

Modified: trunk/applets/fish/fish.c
==============================================================================
--- trunk/applets/fish/fish.c	(original)
+++ trunk/applets/fish/fish.c	Fri Jan 23 17:25:36 2009
@@ -1166,9 +1166,11 @@
 	/* Old method : works for glibc < 2.2 */
 	zone = fopen("/etc/timezone", "r");
 	if (zone) {
-		fscanf (zone, "%255s", location);
+		count = fscanf (zone, "%255s", location);
 		fclose (zone);
-		return location;
+		/* if we could read it, we return what we got */
+		if (count == 1)
+			return location;
 	} 
 
 	/* New method : works for glibc 2.2 */
@@ -1177,6 +1179,7 @@
 	if (!buffer)
 		return NULL;
 
+	len = strlen (buffer);
 	for (i = len, count = 0; (i > 0) && (count != 2); i--)
 		if (buffer [i] == '/')
 			count++;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]