opkg: adding the hash_table_remove API, not using yet.
[oweals/opkg-lede.git] / libopkg / opkg.c
index 4560dc9e5a523e0942dabc7cff69c8b5efd7349b..35ddb89bcebee341774dc75aac8cce4e67e409cc 100644 (file)
@@ -34,6 +34,8 @@
 
 #include <libbb/libbb.h>
 
+struct errlist* error_list;
+
 struct _opkg_t
 {
   args_t *args;
@@ -161,8 +163,7 @@ opkg_package_new ()
 
   opkg_package_t *p;
 
-  p = malloc (sizeof (opkg_package_t));
-  memset (p, 0, sizeof (opkg_package_t));
+  p = calloc (1, sizeof (opkg_package_t));
 
   return p;
 }
@@ -187,9 +188,9 @@ opkg_new ()
   opkg_t *opkg;
   int err;
 
-  opkg = malloc (sizeof (opkg_t));
+  opkg = calloc (1, sizeof (opkg_t));
 
-  opkg->args = malloc (sizeof (args_t));
+  opkg->args = calloc (1, sizeof (args_t));
   err = args_init (opkg->args);
   if (err)
   {
@@ -198,7 +199,7 @@ opkg_new ()
     return NULL;
   }
 
-  opkg->conf = malloc (sizeof (opkg_conf_t));
+  opkg->conf = calloc (1, sizeof (opkg_conf_t));
   err = opkg_conf_init (opkg->conf, opkg->args);
   if (err)
   {
@@ -271,6 +272,12 @@ opkg_re_read_config_files (opkg_t *opkg)
     a->offline_root_post_script_cmd = strdup (c->offline_root_post_script_cmd);
   }
 
+  if (c->cache) {
+    if (a->cache)
+       free (a->cache);
+    a->cache = strdup(c->cache);
+  }
+
   /* throw away old opkg_conf and start again */
   opkg_conf_deinit (opkg->conf);
   opkg_conf_init (opkg->conf, opkg->args);
@@ -871,7 +878,7 @@ opkg_update_package_lists (opkg_t *opkg, opkg_progress_callback_t progress_callb
     free (list_file_name);
     free (url);
 #else
-    /* XXX: Note: Signiture check for %s skipped because GPG support was not
+    /* XXX: Note: Signature check for %s skipped because GPG support was not
      * enabled in this build
      */
 #endif