summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgraham.gower@gmail.com <graham.gower@gmail.com@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2011-02-21 22:39:04 (EST)
committer graham.gower@gmail.com <graham.gower@gmail.com@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2011-02-21 22:39:04 (EST)
commitb71b378dc4580dc8773d8b065c2dbc4f9e701028 (patch)
tree1220ed59f7abf64ac3d076c13420f0e1d41e5209
parent7ac69b203f3dadd51fe32cfe503509005fa92803 (diff)
Fix opkg_re_read_config_files().
This fixes segfaults when opkg_update_package_lists() is called multiple times. git-svn-id: http://opkg.googlecode.com/svn/trunk@609 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
-rw-r--r--libopkg/opkg.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/libopkg/opkg.c b/libopkg/opkg.c
index 574386e..0757370 100644
--- a/libopkg/opkg.c
+++ b/libopkg/opkg.c
@@ -112,11 +112,14 @@ curl_progress_cb(struct _curl_cb_data *cb_data, double t, /* dltotal */
}
+static struct opkg_conf saved_conf;
/*** Public API ***/
int
opkg_new()
{
+ saved_conf = *conf;
+
if (opkg_conf_init())
goto err0;
@@ -150,20 +153,9 @@ opkg_free(void)
int
opkg_re_read_config_files(void)
{
- pkg_hash_deinit();
- pkg_hash_init();
-
- if (pkg_hash_load_feeds())
- goto err;
-
- if (pkg_hash_load_status_files())
- goto err;
-
- return 0;
-
-err:
- pkg_hash_deinit();
- return -1;
+ opkg_free();
+ *conf = saved_conf;
+ return opkg_new();
}
void