From 2921be83ed467d50cc1633c08fa4b51976ef98c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 29 Apr 2006 23:15:40 +0000 Subject: [PATCH] tools/gst-run.c: Fix wrong g_file_test() usage (see glib docs for why it doesn't work); fix typo in error message. Fi... Original commit message from CVS: * tools/gst-run.c: (get_candidates), (main): Fix wrong g_file_test() usage (see glib docs for why it doesn't work); fix typo in error message. Fixes #340079. --- ChangeLog | 6 ++++++ tools/gst-run.c | 12 +++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 502a655232..ce269d4cec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-04-30 Tim-Philipp Müller + + * tools/gst-run.c: (get_candidates), (main): + Fix wrong g_file_test() usage (see glib docs for why it doesn't + work); fix typo in error message. Fixes #340079. + 2006-04-29 Thomas Vander Stichele * common/Makefile.am: diff --git a/tools/gst-run.c b/tools/gst-run.c index 9fbf975a8a..a648753f11 100644 --- a/tools/gst-run.c +++ b/tools/gst-run.c @@ -232,8 +232,10 @@ get_candidates (const gchar * dir, const gchar * base) while (cur != &dirs[0]) { --cur; - if (!g_file_test (*cur, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) + if (!g_file_test (*cur, G_FILE_TEST_EXISTS) || + !g_file_test (*cur, G_FILE_TEST_IS_DIR)) { continue; + } gdir = g_dir_open (*cur, 0, &error); if (!gdir) { @@ -326,9 +328,13 @@ main (int argc, char **argv) highest = NULL; /* otherwise, just look up the highest version */ - g_hash_table_foreach (candidates, (GHFunc) find_highest_version, &highest); + if (candidates) { + g_hash_table_foreach (candidates, (GHFunc) find_highest_version, + &highest); + } + if (highest == NULL) { - g_print ("ERROR: No version of tool %s not found.\n", base); + g_print ("ERROR: No version of tool %s found.\n", base); return 1; } dir = g_hash_table_lookup (candidates, highest);