summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2012-02-22 09:28:39 +0000
committerRichard Hughes <richard@hughsie.com>2012-04-04 14:40:49 +0100
commit681ff8d44bbb595d25f58ae6c3697b75d4a85b4b (patch)
tree1114fd0f71b7af56fe9c5c6b8e49c364f8899a41
parentff9e60de13fe56141d0211c717dfff6ffebb4dd1 (diff)
zif: Ensure the files are sorted by name before returning them to the daemon
-rw-r--r--backends/zif/pk-backend-zif.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index 84deeff98..ff02f5f06 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -2724,6 +2724,15 @@ out:
}
/**
+ * pk_backend_sort_string_cb:
+ **/
+static gint
+pk_backend_sort_string_cb (const gchar **a, const gchar **b)
+{
+ return g_strcmp0 (*a, *b);
+}
+
+/**
* pk_backend_get_files_thread:
*/
static gboolean
@@ -2833,6 +2842,9 @@ pk_backend_get_files_thread (PkBackend *backend)
goto out;
}
+ /* sort these by name and add to list */
+ g_ptr_array_sort (files,
+ (GCompareFunc) pk_backend_sort_string_cb);
files_str = g_string_new ("");
for (j=0; j<files->len; j++) {
file = g_ptr_array_index (files, j);