summaryrefslogtreecommitdiffstats
path: root/libopkg/opkg_conf.c
diff options
context:
space:
mode:
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-12 21:57:43 (EST)
committer graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-12 21:57:43 (EST)
commit51e968e4ddffd4acd7c71e4976e1254a590f2217 (patch)
tree450eb0cb4c2f44a0ec5f207d6ebaaf607c0c8a7d /libopkg/opkg_conf.c
parent1052b2193d46d5c1251eb0e9285555f868ba543b (diff)
Remove status_file_tmp_name. This code does not improve robustness.
git-svn-id: http://opkg.googlecode.com/svn/trunk@296 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg/opkg_conf.c')
-rw-r--r--libopkg/opkg_conf.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c
index 47e11ec..dc2c5f9 100644
--- a/libopkg/opkg_conf.c
+++ b/libopkg/opkg_conf.c
@@ -688,17 +688,18 @@ int opkg_conf_write_status_files(opkg_conf_t *conf)
pkg_vec_t *all;
pkg_t *pkg;
int i;
- int err;
- FILE * status_file=NULL;
+ FILE *fp;
if (conf->noaction)
return 0;
dest = (pkg_dest_t *)void_list_first(&conf->pkg_dest_list)->data;
- status_file = fopen(dest->status_file_tmp_name, "w");
- if (status_file == NULL) {
+
+ 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_tmp_name, strerror(errno));
+ __FUNCTION__, dest->status_file_name, strerror(errno));
+ return -1;
}
all = pkg_vec_alloc();
@@ -719,25 +720,12 @@ int opkg_conf_write_status_files(opkg_conf_t *conf)
__FUNCTION__, pkg->name);
continue;
}
- if (status_file) {
- pkg_print_status(pkg, status_file);
- }
+ pkg_print_status(pkg, fp);
}
pkg_vec_free(all);
+ fclose(fp);
- if (status_file) {
- err = ferror(status_file);
- fclose(status_file);
- if (!err) {
- file_move(dest->status_file_tmp_name, dest->status_file_name);
- } else {
- fprintf(stderr, "%s: ERROR: An error has occurred writing %s, "
- "retaining old %s\n", __FUNCTION__,
- dest->status_file_tmp_name, dest->status_file_name);
- }
- status_file = NULL;
- }
return 0;
}