]>
Commit | Line | Data |
---|---|---|
577193a4 JB |
1 | --- PackageKit-0.8.11/backends/poldek/pk-backend-poldek.c.orig 2013-08-28 17:13:58.000000000 +0200 |
2 | +++ PackageKit-0.8.11/backends/poldek/pk-backend-poldek.c 2013-09-29 20:38:57.392493190 +0200 | |
3 | @@ -148,6 +148,9 @@ | |
4 | * Returns TRUE on success, FALSE when some error occurs. | |
5 | **/ | |
6 | static gboolean | |
7 | +execute_command (const gchar *format, ...) G_GNUC_PRINTF(1, 2); | |
8 | + | |
9 | +static gboolean | |
10 | execute_command (const gchar *format, ...) | |
11 | { | |
12 | struct poclidek_rcmd *rcmd; | |
13 | @@ -186,6 +189,9 @@ | |
14 | * result of specified command. On failure returns NULL. | |
15 | **/ | |
16 | static tn_array* | |
17 | +execute_packages_command (const gchar *format, ...) G_GNUC_PRINTF(1, 2); | |
18 | + | |
19 | +static tn_array* | |
20 | execute_packages_command (const gchar *format, ...) | |
21 | { | |
22 | struct poclidek_rcmd *rcmd; | |
23 | @@ -1851,7 +1857,7 @@ | |
24 | command = g_string_free (cmd, FALSE); | |
25 | ||
26 | if (toupdate > 0) { | |
27 | - if (execute_command (command) == FALSE) { | |
28 | + if (execute_command ("%s", command) == FALSE) { | |
29 | pb_error_show (job, PK_ERROR_ENUM_TRANSACTION_ERROR); | |
30 | } | |
31 | } | |
32 | @@ -2021,7 +2027,7 @@ | |
33 | errorcode = PK_ERROR_ENUM_PACKAGE_ALREADY_INSTALLED; | |
34 | ||
35 | if (errorcode != PK_ERROR_ENUM_UNKNOWN) { | |
36 | - pk_backend_job_error_code (job, errorcode, pberror->tslog->str); | |
37 | + pk_backend_job_error_code (job, errorcode, "%s", pberror->tslog->str); | |
38 | return TRUE; | |
39 | } | |
40 | ||
41 | @@ -2506,12 +2512,14 @@ | |
42 | struct pkg *pkg = n_array_nth (pkgs, i); | |
43 | gchar *package_id; | |
44 | gchar *path; | |
45 | + gchar *to_strv[] = { NULL, NULL }; | |
46 | gchar buf[256]; | |
47 | ||
48 | package_id = package_id_from_pkg (pkg, NULL, PK_FILTER_ENUM_NONE); | |
49 | path = g_build_filename (destdir, pkg_filename (pkg, buf, sizeof (buf)), NULL); | |
50 | + to_strv[0] = path; | |
51 | ||
52 | - pk_backend_job_files (job, package_id, path); | |
53 | + pk_backend_job_files (job, package_id, to_strv); | |
54 | ||
55 | g_free (package_id); | |
56 | g_free (path); | |
57 | @@ -2670,19 +2678,15 @@ | |
58 | ||
59 | if (pkg != NULL) { | |
60 | struct pkgflist *flist = pkg_get_flist (pkg); | |
61 | - GString *filelist; | |
62 | - gchar *result; | |
63 | - const gchar *sep; | |
64 | + GPtrArray *files; | |
65 | gint i, j; | |
66 | ||
67 | - sep = ""; | |
68 | - | |
69 | if (flist == NULL) { | |
70 | pkg_free (pkg); | |
71 | continue; | |
72 | } | |
73 | ||
74 | - filelist = g_string_new (""); | |
75 | + files = g_ptr_array_new_with_free_func(g_free); | |
76 | ||
77 | for (i = 0; i < n_tuple_size (flist->fl); i++) { | |
78 | struct pkgfl_ent *flent = n_tuple_nth (flist->fl, i); | |
79 | @@ -2692,22 +2696,20 @@ | |
80 | ||
81 | for (j = 0; j < flent->items; j++) { | |
82 | struct flfile *f = flent->files[j]; | |
83 | + gchar *fname; | |
84 | ||
85 | if (strcmp (dirname, "/") == 0) | |
86 | - g_string_append_printf (filelist, "%s/%s", sep, f->basename); | |
87 | + fname = g_strdup_printf("/%s", f->basename); | |
88 | else | |
89 | - g_string_append_printf (filelist, "%s%s/%s", sep, dirname, f->basename); | |
90 | - | |
91 | - sep = ";"; | |
92 | + fname = g_strdup_printf("%s/%s", dirname, f->basename); | |
93 | + g_ptr_array_add (files, fname); | |
94 | } | |
95 | g_free (dirname); | |
96 | } | |
97 | ||
98 | - result = g_string_free (filelist, FALSE); | |
99 | - | |
100 | - pk_backend_job_files (job, package_ids[n], result); | |
101 | - | |
102 | - g_free (result); | |
103 | + g_ptr_array_add(files, NULL); | |
104 | + pk_backend_job_files (job, package_ids[n], (gchar**)files->pdata); | |
105 | + g_ptr_array_unref (files); | |
106 | ||
107 | pkg_free (pkg); | |
108 | } | |
109 | @@ -3081,7 +3083,7 @@ | |
110 | ||
111 | pk_backend_job_set_status (job, PK_STATUS_ENUM_DEP_RESOLVE); | |
112 | ||
113 | - if (execute_command (command)) { | |
114 | + if (execute_command ("%s", command)) { | |
115 | pb_error_check (job); | |
116 | } else { | |
117 | pb_error_show (job, PK_ERROR_ENUM_TRANSACTION_ERROR); | |
118 | @@ -3221,8 +3223,8 @@ | |
119 | ||
120 | pk_backend_job_set_status (job, PK_STATUS_ENUM_DEP_RESOLVE); | |
121 | ||
122 | - if (execute_command (command) == FALSE) { | |
123 | - pk_backend_job_error_code (job, PK_ERROR_ENUM_CANNOT_REMOVE_SYSTEM_PACKAGE, pberror->tslog->str); | |
124 | + if (execute_command ("%s", command) == FALSE) { | |
125 | + pk_backend_job_error_code (job, PK_ERROR_ENUM_CANNOT_REMOVE_SYSTEM_PACKAGE, "%s", pberror->tslog->str); | |
126 | } | |
127 | ||
128 | g_free (command); |