From 10e18bc13759efae20237fdd353070d193c80101 Mon Sep 17 00:00:00 2001 From: Daniel Pavel Date: Mon, 22 Oct 2012 00:55:00 +0300 Subject: [PATCH] accept '*' as last character in an exclude filter to match multiple mount points --- panel-plugin/devices.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/panel-plugin/devices.c b/panel-plugin/devices.c index 1bd8880..bcb149e 100644 --- a/panel-plugin/devices.c +++ b/panel-plugin/devices.c @@ -569,14 +569,22 @@ exclude_filesystem (GPtrArray *excluded_FSs, gchar *mountpoint, gchar *device) for (i=0; i < excluded_FSs->len; i++) { - DBG("Comparing %s and %s to %s", mountpoint, device, (gchar *) g_ptr_array_index(excluded_FSs, i)); - if (g_ascii_strcasecmp ( - (gchar *) g_ptr_array_index(excluded_FSs, i), mountpoint)==0 + gchar *excluded_fs = (gchar *) g_ptr_array_index(excluded_FSs, i); + DBG("Comparing %s and %s to %s", mountpoint, device, excluded_fs); + + if (g_ascii_strcasecmp (excluded_fs, mountpoint)==0 || - g_ascii_strcasecmp ( - (gchar *) g_ptr_array_index(excluded_FSs, i), device)==0 + g_ascii_strcasecmp (excluded_fs, device)==0 ) return TRUE; + + size_t excluded_fs_len1 = strlen(excluded_fs) - 1; + if (excluded_fs[excluded_fs_len1]=='*') + if (g_ascii_strncasecmp (excluded_fs, mountpoint, excluded_fs_len1)==0 + || + g_ascii_strncasecmp (excluded_fs, device, excluded_fs_len1)==0 + ) + return TRUE; } TRACE("Leaving exclude_filesystems with FALSE"); -- 1.7.10.4