projects
/
oweals
/
opkg-lede.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
opkg: report errors from opkg_remove_pkg
[oweals/opkg-lede.git]
/
libopkg
/
opkg.c
diff --git
a/libopkg/opkg.c
b/libopkg/opkg.c
index 00d595e04110a2f5fb74bc3e44384157c09cc6fc..ec524f9146961a1404fddf5c4b7d9c024ae86591 100644
(file)
--- a/
libopkg/opkg.c
+++ b/
libopkg/opkg.c
@@
-455,6
+455,13
@@
opkg_install_package (opkg_t *opkg, const char *package_name, opkg_progress_call
(curl_progress_func) curl_progress_cb, &cb_data);
free(url);
(curl_progress_func) curl_progress_cb, &cb_data);
free(url);
+ if (err)
+ {
+ pkg_vec_free (deps);
+ opkg_package_free (pdata.package);
+ return OPKG_DOWNLOAD_FAILED;
+ }
+
}
pkg_vec_free (deps);
}
pkg_vec_free (deps);
@@
-478,14
+485,20
@@
opkg_install_package (opkg_t *opkg, const char *package_name, opkg_progress_call
err = opkg_install_pkg(opkg->conf, new, 0);
if (err)
err = opkg_install_pkg(opkg->conf, new, 0);
if (err)
- return err;
+ {
+ opkg_package_free (pdata.package);
+ return OPKG_UNKNOWN_ERROR;
+ }
progress (pdata, 75);
/* run configure scripts, etc. */
err = opkg_configure_packages (opkg->conf, NULL);
if (err)
progress (pdata, 75);
/* run configure scripts, etc. */
err = opkg_configure_packages (opkg->conf, NULL);
if (err)
- return err;
+ {
+ opkg_package_free (pdata.package);
+ return OPKG_UNKNOWN_ERROR;
+ }
/* write out status files and file lists */
opkg_conf_write_status_files (opkg->conf);
/* write out status files and file lists */
opkg_conf_write_status_files (opkg->conf);
@@
-499,6
+512,7
@@
opkg_install_package (opkg_t *opkg, const char *package_name, opkg_progress_call
int
opkg_remove_package (opkg_t *opkg, const char *package_name, opkg_progress_callback_t progress_callback, void *user_data)
{
int
opkg_remove_package (opkg_t *opkg, const char *package_name, opkg_progress_callback_t progress_callback, void *user_data)
{
+ int err;
pkg_t *pkg = NULL;
pkg_t *pkg_to_remove;
opkg_progress_data_t pdata;
pkg_t *pkg = NULL;
pkg_t *pkg_to_remove;
opkg_progress_data_t pdata;
@@
-506,11
+520,8
@@
opkg_remove_package (opkg_t *opkg, const char *package_name, opkg_progress_callb
opkg_assert (opkg != NULL);
opkg_assert (package_name != NULL);
opkg_assert (opkg != NULL);
opkg_assert (package_name != NULL);
-
-
pkg_info_preinstall_check (opkg->conf);
pkg_info_preinstall_check (opkg->conf);
-
pkg = pkg_hash_fetch_installed_by_name (&opkg->conf->pkg_hash, package_name);
if (pkg == NULL)
pkg = pkg_hash_fetch_installed_by_name (&opkg->conf->pkg_hash, package_name);
if (pkg == NULL)
@@
-545,7
+556,7
@@
opkg_remove_package (opkg_t *opkg, const char *package_name, opkg_progress_callb
progress (pdata, 75);
progress (pdata, 75);
- opkg_remove_pkg (opkg->conf, pkg_to_remove, 0);
+
err =
opkg_remove_pkg (opkg->conf, pkg_to_remove, 0);
/* write out status files and file lists */
opkg_conf_write_status_files (opkg->conf);
/* write out status files and file lists */
opkg_conf_write_status_files (opkg->conf);
@@
-554,12
+565,13
@@
opkg_remove_package (opkg_t *opkg, const char *package_name, opkg_progress_callb
progress (pdata, 100);
opkg_package_free (pdata.package);
progress (pdata, 100);
opkg_package_free (pdata.package);
- return
0
;
+ return
(err) ? OPKG_UNKNOWN_ERROR : OPKG_NO_ERROR
;
}
int
opkg_upgrade_package (opkg_t *opkg, const char *package_name, opkg_progress_callback_t progress_callback, void *user_data)
{
}
int
opkg_upgrade_package (opkg_t *opkg, const char *package_name, opkg_progress_callback_t progress_callback, void *user_data)
{
+ int err;
pkg_t *pkg;
opkg_progress_data_t pdata;
pkg_t *pkg;
opkg_progress_data_t pdata;
@@
-597,10
+609,14
@@
opkg_upgrade_package (opkg_t *opkg, const char *package_name, opkg_progress_call
pdata.package = old_pkg_to_new (pkg);
progress (pdata, 0);
pdata.package = old_pkg_to_new (pkg);
progress (pdata, 0);
- opkg_upgrade_pkg (opkg->conf, pkg);
+ err = opkg_upgrade_pkg (opkg->conf, pkg);
+ if (err)
+ return OPKG_UNKNOWN_ERROR;
progress (pdata, 75);
progress (pdata, 75);
- opkg_configure_packages (opkg->conf, NULL);
+ err = opkg_configure_packages (opkg->conf, NULL);
+ if (err)
+ return OPKG_UNKNOWN_ERROR;
progress (pdata, 100);
opkg_package_free (pdata.package);
return 0;
progress (pdata, 100);
opkg_package_free (pdata.package);
return 0;