summaryrefslogtreecommitdiffstats
path: root/libopkg/opkg_cmd.c
diff options
context:
space:
mode:
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2008-12-15 00:22:06 (EST)
committer ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2008-12-15 00:22:06 (EST)
commit9e85c59c8df6dd151fce6238811844d8d66ea1c0 (patch)
treefda715b0c88fb02029a6a42ed1768511a0ae4a0f /libopkg/opkg_cmd.c
parent38171e005d8bc496389bccdf8b9f8449b7b227a5 (diff)
opkg: Consolidate error reporting from opkg_conf_init and ensure return value is
checked in the appropriate places. opkg: Add a locking mechanism to prevent two instances of opkg being run at the same time. git-svn-id: http://opkg.googlecode.com/svn/trunk@130 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg/opkg_cmd.c')
-rw-r--r--libopkg/opkg_cmd.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c
index 94cfb99..e91a24c 100644
--- a/libopkg/opkg_cmd.c
+++ b/libopkg/opkg_cmd.c
@@ -138,6 +138,23 @@ opkg_cmd_t *opkg_cmd_find(const char *name)
return NULL;
}
+void opkg_print_error_list (opkg_conf_t *conf)
+{
+ if ( error_list ) {
+ reverse_error_list(&error_list);
+
+ printf ("Collected errors:\n");
+ /* Here we print the errors collected and free the list */
+ while (error_list != NULL) {
+ printf (" * %s", error_list->errmsg);
+ error_list = error_list->next;
+
+ }
+ free_error_list(&error_list);
+ }
+
+}
+
int opkg_cmd_exec(opkg_cmd_t *cmd, opkg_conf_t *conf, int argc, const char **argv, void *userdata)
{
int result;
@@ -150,20 +167,8 @@ int opkg_cmd_exec(opkg_cmd_t *cmd, opkg_conf_t *conf, int argc, const char **arg
opkg_message(conf, OPKG_NOTICE, "An error ocurred, return value: %d.\n", result);
}
- if ( error_list ) {
- reverse_error_list(&error_list);
-
- opkg_message(conf, OPKG_NOTICE, "Collected errors:\n");
- /* Here we print the errors collected and free the list */
- while (error_list != NULL) {
- opkg_message(conf, OPKG_NOTICE, " * %s", error_list->errmsg);
- error_list = error_list->next;
+ opkg_print_error_list (conf);
- }
- free_error_list(&error_list);
-
- }
-
p_userdata = NULL;
return result;
}