summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn L McGrath2001-10-23 17:52:28 +0000
committerGlenn L McGrath2001-10-23 17:52:28 +0000
commit6ccdd8c122ea6ccfc1360d19c0066c1037d8ac02 (patch)
tree577bbbe77cca3c88f926cf9d3262971789d2dca8
parentc2e5b977ab85739ae33536b90237a11802abefe5 (diff)
downloadbusybox-6ccdd8c122ea6ccfc1360d19c0066c1037d8ac02.zip
busybox-6ccdd8c122ea6ccfc1360d19c0066c1037d8ac02.tar.gz
Abort if scripts return value != 0
-rw-r--r--archival/dpkg.c13
-rw-r--r--dpkg.c13
2 files changed, 6 insertions, 20 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c
index d566bfe..bf0dcf3 100644
--- a/archival/dpkg.c
+++ b/archival/dpkg.c
@@ -1232,7 +1232,7 @@ void purge_package(const unsigned int package_num)
char list_name[strlen(package_name) + 25];
/* run prerm script */
- if (run_package_script(package_name, "prerm") == -1) {
+ if (run_package_script(package_name, "prerm") != 0) {
error_msg_and_die("script failed, prerm failure");
}
@@ -1269,7 +1269,6 @@ void unpack_package(deb_file_t *deb_file)
FILE *out_stream;
char *info_prefix;
- int return_value;
/* If existing version, remove it first */
if (strcmp(name_hashtable[get_status(status_num, 3)], "installed") == 0) {
@@ -1288,11 +1287,7 @@ void unpack_package(deb_file_t *deb_file)
deb_extract(deb_file->filename, stdout, (extract_quiet | extract_control_tar_gz | extract_all_to_fs | extract_unconditional), info_prefix, NULL);
/* Run the preinst prior to extracting */
- return_value = run_package_script(package_name, "preinst");
- if (return_value == -1) {
- error_msg_and_die("could not execute pre-installation script.");
- }
- if (return_value != 0) {
+ if (run_package_script(package_name, "preinst") != 0) {
/* when preinst returns exit code != 0 then quit installation process */
error_msg_and_die("subprocess pre-installation script returned error.");
}
@@ -1318,13 +1313,11 @@ void configure_package(deb_file_t *deb_file)
const char *package_name = name_hashtable[package_hashtable[deb_file->package]->name];
const char *package_version = name_hashtable[package_hashtable[deb_file->package]->version];
const int status_num = search_status_hashtable(package_name);
- int return_value;
printf("Setting up %s (%s)\n", package_name, package_version);
/* Run the postinst script */
- return_value = run_package_script(package_name, "postinst");
- if (return_value == -1) {
+ if (run_package_script(package_name, "postinst") != 0) {
/* TODO: handle failure gracefully */
error_msg_and_die("postrm failure.. set status to what?");
}
diff --git a/dpkg.c b/dpkg.c
index d566bfe..bf0dcf3 100644
--- a/dpkg.c
+++ b/dpkg.c
@@ -1232,7 +1232,7 @@ void purge_package(const unsigned int package_num)
char list_name[strlen(package_name) + 25];
/* run prerm script */
- if (run_package_script(package_name, "prerm") == -1) {
+ if (run_package_script(package_name, "prerm") != 0) {
error_msg_and_die("script failed, prerm failure");
}
@@ -1269,7 +1269,6 @@ void unpack_package(deb_file_t *deb_file)
FILE *out_stream;
char *info_prefix;
- int return_value;
/* If existing version, remove it first */
if (strcmp(name_hashtable[get_status(status_num, 3)], "installed") == 0) {
@@ -1288,11 +1287,7 @@ void unpack_package(deb_file_t *deb_file)
deb_extract(deb_file->filename, stdout, (extract_quiet | extract_control_tar_gz | extract_all_to_fs | extract_unconditional), info_prefix, NULL);
/* Run the preinst prior to extracting */
- return_value = run_package_script(package_name, "preinst");
- if (return_value == -1) {
- error_msg_and_die("could not execute pre-installation script.");
- }
- if (return_value != 0) {
+ if (run_package_script(package_name, "preinst") != 0) {
/* when preinst returns exit code != 0 then quit installation process */
error_msg_and_die("subprocess pre-installation script returned error.");
}
@@ -1318,13 +1313,11 @@ void configure_package(deb_file_t *deb_file)
const char *package_name = name_hashtable[package_hashtable[deb_file->package]->name];
const char *package_version = name_hashtable[package_hashtable[deb_file->package]->version];
const int status_num = search_status_hashtable(package_name);
- int return_value;
printf("Setting up %s (%s)\n", package_name, package_version);
/* Run the postinst script */
- return_value = run_package_script(package_name, "postinst");
- if (return_value == -1) {
+ if (run_package_script(package_name, "postinst") != 0) {
/* TODO: handle failure gracefully */
error_msg_and_die("postrm failure.. set status to what?");
}