summaryrefslogtreecommitdiffstats
path: root/libopkg/opkg_conf.c
diff options
context:
space:
mode:
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-14 23:23:56 (EST)
committer graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-14 23:23:56 (EST)
commitd1f5d3cf0cbf26f82cf76a09a0cdca685aee9443 (patch)
treeb265080fa6a16989ebf3aa6a059b703ee571b5f9 /libopkg/opkg_conf.c
parent3c6599f1f39f1b460c12284682e46a2953b4e535 (diff)
Write out status files for the correct pkg->dest, instead of the default.
git-svn-id: http://opkg.googlecode.com/svn/trunk@301 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg/opkg_conf.c')
-rw-r--r--libopkg/opkg_conf.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c
index 2a3ea0c..425c72b 100644
--- a/libopkg/opkg_conf.c
+++ b/libopkg/opkg_conf.c
@@ -687,22 +687,24 @@ static int opkg_conf_set_option(const opkg_option_t *options,
int opkg_conf_write_status_files(opkg_conf_t *conf)
{
+ pkg_dest_list_elt_t *iter;
pkg_dest_t *dest;
pkg_vec_t *all;
pkg_t *pkg;
- int i;
- FILE *fp;
+ int i, ret = 0;
if (conf->noaction)
return 0;
- dest = (pkg_dest_t *)void_list_first(&conf->pkg_dest_list)->data;
+ list_for_each_entry(iter, &conf->pkg_dest_list.head, node) {
+ dest = (pkg_dest_t *)iter->data;
- fp = fopen(dest->status_file_name, "w");
- if (fp == NULL) {
- fprintf(stderr, "%s: Can't open status file: %s for writing: %s\n",
- __FUNCTION__, dest->status_file_name, strerror(errno));
- return -1;
+ dest->status_fp = fopen(dest->status_file_name, "w");
+ if (dest->status_fp == NULL) {
+ fprintf(stderr, "%s: Can't open status file: %s: %s\n",
+ __FUNCTION__, dest->status_file_name, strerror(errno));
+ ret = -1;
+ }
}
all = pkg_vec_alloc();
@@ -723,13 +725,18 @@ int opkg_conf_write_status_files(opkg_conf_t *conf)
__FUNCTION__, pkg->name);
continue;
}
- pkg_print_status(pkg, fp);
+ if (pkg->dest->status_fp)
+ pkg_print_status(pkg, pkg->dest->status_fp);
}
pkg_vec_free(all);
- fclose(fp);
- return 0;
+ list_for_each_entry(iter, &conf->pkg_dest_list.head, node) {
+ dest = (pkg_dest_t *)iter->data;
+ fclose(dest->status_fp);
+ }
+
+ return ret;
}