[tracker] Check return value of important GLib calls, found by coverity



commit 7ba0d09cc843262277134bfccd564970f2a0ec34
Author: Martyn Russell <martyn imendio com>
Date:   Wed May 13 15:53:07 2009 +0100

    Check return value of important GLib calls, found by coverity
---
 src/libtracker-common/tracker-albumart.c |    8 +++++++-
 src/tracker-utils/tracker-processes.c    |    4 +---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/libtracker-common/tracker-albumart.c b/src/libtracker-common/tracker-albumart.c
index fbd2d0b..e592f31 100644
--- a/src/libtracker-common/tracker-albumart.c
+++ b/src/libtracker-common/tracker-albumart.c
@@ -440,7 +440,13 @@ tracker_albumart_heuristic (const gchar *artist_,
 	retval = FALSE;
 	file = NULL;
 
-	g_stat (dirname, &st);
+	if (g_stat (dirname, &st) == -1) {
+		g_warning ("Could not g_stat() directory:'%s' for albumart heuristic",
+			   dirname);
+		g_free (dirname);
+		return FALSE;
+	}
+
 	/* do not count . and .. */
 	count = st.st_nlink - 2;
 	
diff --git a/src/tracker-utils/tracker-processes.c b/src/tracker-utils/tracker-processes.c
index aa40484..e61a8ae 100644
--- a/src/tracker-utils/tracker-processes.c
+++ b/src/tracker-utils/tracker-processes.c
@@ -165,9 +165,7 @@ main (int argc, char **argv)
 		gchar **strv;
 
 		filename = g_build_filename ("/proc", l->data, "cmdline", NULL);
-		g_file_get_contents (filename, &contents, NULL, &error);
-
-		if (error) {	
+		if (!g_file_get_contents (filename, &contents, NULL, &error)) {
 			str = g_strdup_printf (_("Could not open '%s'"), filename);
 			g_printerr ("%s, %s\n", 
 				    str,



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