summaryrefslogtreecommitdiffstats
path: root/libopkg/pkg.c
diff options
context:
space:
mode:
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-26 19:42:00 (EST)
committer graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-26 19:42:00 (EST)
commit6afed21188df0c417349563621302ec85f44096f (patch)
tree0a4bd7580dad1cfdea65dfcbfc948b3102271ad7 /libopkg/pkg.c
parenta5ef09fae04cd4274542b9f5f052e439e56450fc (diff)
Provide error checking for users of pkg_extract_* functions.
git-svn-id: http://opkg.googlecode.com/svn/trunk@391 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg/pkg.c')
-rw-r--r--libopkg/pkg.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/libopkg/pkg.c b/libopkg/pkg.c
index 278b727..58c133d 100644
--- a/libopkg/pkg.c
+++ b/libopkg/pkg.c
@@ -309,8 +309,11 @@ pkg_init_from_file(opkg_conf_t *conf, pkg_t *pkg, const char *filename)
}
err = pkg_extract_control_file_to_stream(pkg, control_file);
- if (err)
+ if (err) {
+ opkg_message(conf, OPKG_ERROR, "Failed to extract control file"
+ " from %s\n", filename);
goto err2;
+ }
rewind(control_file);
@@ -1152,12 +1155,14 @@ pkg_get_installed_files(opkg_conf_t *conf, pkg_t *pkg)
err = pkg_extract_data_file_names_to_stream(pkg, list_file);
if (err) {
opkg_message(conf, OPKG_ERROR, "%s: Error extracting file list "
- "from %s: %s\n", __FUNCTION__,
- pkg->local_filename, strerror(err));
+ "from %s\n", __FUNCTION__,
+ pkg->local_filename);
fclose(list_file);
unlink(list_file_name);
free(list_file_name);
- return pkg->installed_files;
+ str_list_deinit(pkg->installed_files);
+ pkg->installed_files = NULL;
+ return NULL;
}
rewind(list_file);
} else {
@@ -1436,7 +1441,8 @@ pkg_info_preinstall_check(opkg_conf_t *conf)
str_list_t *installed_files = pkg_get_installed_files(conf, pkg); /* this causes installed_files to be cached */
str_list_elt_t *iter, *niter;
if (installed_files == NULL) {
- opkg_message(conf, OPKG_ERROR, "No installed files for pkg %s\n", pkg->name);
+ opkg_message(conf, OPKG_ERROR, "Failed to determine installed "
+ "files for pkg %s.\n", pkg->name);
break;
}
for (iter = str_list_first(installed_files), niter = str_list_next(installed_files, iter);