diff options
Diffstat (limited to 'archival/dpkg.c')
-rw-r--r-- | archival/dpkg.c | 91 |
1 files changed, 45 insertions, 46 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c index 692592268..3288f7e63 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c | |||
@@ -177,7 +177,7 @@ int search_name_hashtable(const char *key) | |||
177 | } | 177 | } |
178 | } | 178 | } |
179 | } | 179 | } |
180 | name_hashtable[probe_address] = xstrdup(key); | 180 | name_hashtable[probe_address] = bb_xstrdup(key); |
181 | return(probe_address); | 181 | return(probe_address); |
182 | } | 182 | } |
183 | 183 | ||
@@ -218,10 +218,10 @@ int version_compare_part(const char *version1, const char *version2) | |||
218 | int ret; | 218 | int ret; |
219 | 219 | ||
220 | if (version1 == NULL) { | 220 | if (version1 == NULL) { |
221 | version1 = xstrdup(""); | 221 | version1 = bb_xstrdup(""); |
222 | } | 222 | } |
223 | if (version2 == NULL) { | 223 | if (version2 == NULL) { |
224 | version2 = xstrdup(""); | 224 | version2 = bb_xstrdup(""); |
225 | } | 225 | } |
226 | upstream_len1 = strlen(version1); | 226 | upstream_len1 = strlen(version1); |
227 | upstream_len2 = strlen(version2); | 227 | upstream_len2 = strlen(version2); |
@@ -229,10 +229,10 @@ int version_compare_part(const char *version1, const char *version2) | |||
229 | while ((len1 < upstream_len1) || (len2 < upstream_len2)) { | 229 | while ((len1 < upstream_len1) || (len2 < upstream_len2)) { |
230 | /* Compare non-digit section */ | 230 | /* Compare non-digit section */ |
231 | tmp_int = strcspn(&version1[len1], "0123456789"); | 231 | tmp_int = strcspn(&version1[len1], "0123456789"); |
232 | name1_char = xstrndup(&version1[len1], tmp_int); | 232 | name1_char = bb_xstrndup(&version1[len1], tmp_int); |
233 | len1 += tmp_int; | 233 | len1 += tmp_int; |
234 | tmp_int = strcspn(&version2[len2], "0123456789"); | 234 | tmp_int = strcspn(&version2[len2], "0123456789"); |
235 | name2_char = xstrndup(&version2[len2], tmp_int); | 235 | name2_char = bb_xstrndup(&version2[len2], tmp_int); |
236 | len2 += tmp_int; | 236 | len2 += tmp_int; |
237 | tmp_int = strcmp(name1_char, name2_char); | 237 | tmp_int = strcmp(name1_char, name2_char); |
238 | free(name1_char); | 238 | free(name1_char); |
@@ -244,10 +244,10 @@ int version_compare_part(const char *version1, const char *version2) | |||
244 | 244 | ||
245 | /* Compare digits */ | 245 | /* Compare digits */ |
246 | tmp_int = strspn(&version1[len1], "0123456789"); | 246 | tmp_int = strspn(&version1[len1], "0123456789"); |
247 | name1_char = xstrndup(&version1[len1], tmp_int); | 247 | name1_char = bb_xstrndup(&version1[len1], tmp_int); |
248 | len1 += tmp_int; | 248 | len1 += tmp_int; |
249 | tmp_int = strspn(&version2[len2], "0123456789"); | 249 | tmp_int = strspn(&version2[len2], "0123456789"); |
250 | name2_char = xstrndup(&version2[len2], tmp_int); | 250 | name2_char = bb_xstrndup(&version2[len2], tmp_int); |
251 | len2 += tmp_int; | 251 | len2 += tmp_int; |
252 | ver_num1 = atoi(name1_char); | 252 | ver_num1 = atoi(name1_char); |
253 | ver_num2 = atoi(name2_char); | 253 | ver_num2 = atoi(name2_char); |
@@ -306,8 +306,8 @@ int version_compare(const unsigned int ver1, const unsigned int ver2) | |||
306 | } | 306 | } |
307 | 307 | ||
308 | /* Compare upstream version */ | 308 | /* Compare upstream version */ |
309 | upstream_ver1 = xstrdup(ver1_ptr); | 309 | upstream_ver1 = bb_xstrdup(ver1_ptr); |
310 | upstream_ver2 = xstrdup(ver2_ptr); | 310 | upstream_ver2 = bb_xstrdup(ver2_ptr); |
311 | 311 | ||
312 | /* Chop off debian version, and store for later use */ | 312 | /* Chop off debian version, and store for later use */ |
313 | deb_ver1 = strrchr(upstream_ver1, '-'); | 313 | deb_ver1 = strrchr(upstream_ver1, '-'); |
@@ -397,7 +397,7 @@ int search_package_hashtable(const unsigned int name, const unsigned int version | |||
397 | */ | 397 | */ |
398 | void add_split_dependencies(common_node_t *parent_node, const char *whole_line, unsigned int edge_type) | 398 | void add_split_dependencies(common_node_t *parent_node, const char *whole_line, unsigned int edge_type) |
399 | { | 399 | { |
400 | char *line = xstrdup(whole_line); | 400 | char *line = bb_xstrdup(whole_line); |
401 | char *line2; | 401 | char *line2; |
402 | char *line_ptr1 = NULL; | 402 | char *line_ptr1 = NULL; |
403 | char *line_ptr2 = NULL; | 403 | char *line_ptr2 = NULL; |
@@ -410,7 +410,7 @@ void add_split_dependencies(common_node_t *parent_node, const char *whole_line, | |||
410 | 410 | ||
411 | field = strtok_r(line, ",", &line_ptr1); | 411 | field = strtok_r(line, ",", &line_ptr1); |
412 | do { | 412 | do { |
413 | line2 = xstrdup(field); | 413 | line2 = bb_xstrdup(field); |
414 | field2 = strtok_r(line2, "|", &line_ptr2); | 414 | field2 = strtok_r(line2, "|", &line_ptr2); |
415 | if ((edge_type == EDGE_DEPENDS) && (strcmp(field, field2) != 0)) { | 415 | if ((edge_type == EDGE_DEPENDS) && (strcmp(field, field2) != 0)) { |
416 | type = EDGE_OR_DEPENDS; | 416 | type = EDGE_OR_DEPENDS; |
@@ -457,7 +457,7 @@ void add_split_dependencies(common_node_t *parent_node, const char *whole_line, | |||
457 | else if (strncmp(version, ">=", offset_ch) == 0) { | 457 | else if (strncmp(version, ">=", offset_ch) == 0) { |
458 | edge->operator = VER_MORE_EQUAL; | 458 | edge->operator = VER_MORE_EQUAL; |
459 | } else { | 459 | } else { |
460 | error_msg_and_die("Illegal operator\n"); | 460 | bb_error_msg_and_die("Illegal operator\n"); |
461 | } | 461 | } |
462 | } | 462 | } |
463 | /* skip to start of version numbers */ | 463 | /* skip to start of version numbers */ |
@@ -588,7 +588,7 @@ unsigned int get_status(const unsigned int status_node, const int num) | |||
588 | status_string += strspn(status_string, " "); | 588 | status_string += strspn(status_string, " "); |
589 | } | 589 | } |
590 | len = strcspn(status_string, " \n\0"); | 590 | len = strcspn(status_string, " \n\0"); |
591 | state_sub_string = xstrndup(status_string, len); | 591 | state_sub_string = bb_xstrndup(status_string, len); |
592 | state_sub_num = search_name_hashtable(state_sub_string); | 592 | state_sub_num = search_name_hashtable(state_sub_string); |
593 | free(state_sub_string); | 593 | free(state_sub_string); |
594 | return(state_sub_num); | 594 | return(state_sub_num); |
@@ -620,7 +620,7 @@ void set_status(const unsigned int status_node_num, const char *new_value, const | |||
620 | status_len = new_value_len; | 620 | status_len = new_value_len; |
621 | break; | 621 | break; |
622 | default: | 622 | default: |
623 | error_msg_and_die("DEBUG ONLY: this shouldnt happen"); | 623 | bb_error_msg_and_die("DEBUG ONLY: this shouldnt happen"); |
624 | } | 624 | } |
625 | 625 | ||
626 | new_status = (char *) xmalloc(want_len + flag_len + status_len + 3); | 626 | new_status = (char *) xmalloc(want_len + flag_len + status_len + 3); |
@@ -638,7 +638,7 @@ void index_status_file(const char *filename) | |||
638 | status_node_t *status_node = NULL; | 638 | status_node_t *status_node = NULL; |
639 | unsigned int status_num; | 639 | unsigned int status_num; |
640 | 640 | ||
641 | status_file = xfopen(filename, "r"); | 641 | status_file = bb_xfopen(filename, "r"); |
642 | while ((control_buffer = fgets_str(status_file, "\n\n")) != NULL) { | 642 | while ((control_buffer = fgets_str(status_file, "\n\n")) != NULL) { |
643 | const unsigned int package_num = fill_package_struct(control_buffer); | 643 | const unsigned int package_num = fill_package_struct(control_buffer); |
644 | if (package_num != -1) { | 644 | if (package_num != -1) { |
@@ -648,7 +648,7 @@ void index_status_file(const char *filename) | |||
648 | if (status_line != NULL) { | 648 | if (status_line != NULL) { |
649 | status_line += 7; | 649 | status_line += 7; |
650 | status_line += strspn(status_line, " \n\t"); | 650 | status_line += strspn(status_line, " \n\t"); |
651 | status_line = xstrndup(status_line, strcspn(status_line, "\n\0")); | 651 | status_line = bb_xstrndup(status_line, strcspn(status_line, "\n\0")); |
652 | status_node->status = search_name_hashtable(status_line); | 652 | status_node->status = search_name_hashtable(status_line); |
653 | free(status_line); | 653 | free(status_line); |
654 | } | 654 | } |
@@ -754,8 +754,8 @@ void write_buffer_no_status(FILE *new_status_file, const char *control_buffer) | |||
754 | /* This could do with a cleanup */ | 754 | /* This could do with a cleanup */ |
755 | void write_status_file(deb_file_t **deb_file) | 755 | void write_status_file(deb_file_t **deb_file) |
756 | { | 756 | { |
757 | FILE *old_status_file = xfopen("/var/lib/dpkg/status", "r"); | 757 | FILE *old_status_file = bb_xfopen("/var/lib/dpkg/status", "r"); |
758 | FILE *new_status_file = xfopen("/var/lib/dpkg/status.udeb", "w"); | 758 | FILE *new_status_file = bb_xfopen("/var/lib/dpkg/status.udeb", "w"); |
759 | char *package_name; | 759 | char *package_name; |
760 | char *status_from_file; | 760 | char *status_from_file; |
761 | char *control_buffer = NULL; | 761 | char *control_buffer = NULL; |
@@ -773,14 +773,14 @@ void write_status_file(deb_file_t **deb_file) | |||
773 | 773 | ||
774 | tmp_string += 8; | 774 | tmp_string += 8; |
775 | tmp_string += strspn(tmp_string, " \n\t"); | 775 | tmp_string += strspn(tmp_string, " \n\t"); |
776 | package_name = xstrndup(tmp_string, strcspn(tmp_string, "\n\0")); | 776 | package_name = bb_xstrndup(tmp_string, strcspn(tmp_string, "\n\0")); |
777 | write_flag = FALSE; | 777 | write_flag = FALSE; |
778 | tmp_string = strstr(control_buffer, "Status:"); | 778 | tmp_string = strstr(control_buffer, "Status:"); |
779 | if (tmp_string != NULL) { | 779 | if (tmp_string != NULL) { |
780 | /* Seperate the status value from the control buffer */ | 780 | /* Seperate the status value from the control buffer */ |
781 | tmp_string += 7; | 781 | tmp_string += 7; |
782 | tmp_string += strspn(tmp_string, " \n\t"); | 782 | tmp_string += strspn(tmp_string, " \n\t"); |
783 | status_from_file = xstrndup(tmp_string, strcspn(tmp_string, "\n")); | 783 | status_from_file = bb_xstrndup(tmp_string, strcspn(tmp_string, "\n")); |
784 | } else { | 784 | } else { |
785 | status_from_file = NULL; | 785 | status_from_file = NULL; |
786 | } | 786 | } |
@@ -810,7 +810,7 @@ void write_status_file(deb_file_t **deb_file) | |||
810 | } | 810 | } |
811 | /* This is temperary, debugging only */ | 811 | /* This is temperary, debugging only */ |
812 | if (deb_file[i] == NULL) { | 812 | if (deb_file[i] == NULL) { |
813 | error_msg_and_die("ALERT: Couldnt find a control file, your status file may be broken, status may be incorrect for %s", package_name); | 813 | bb_error_msg_and_die("ALERT: Couldnt find a control file, your status file may be broken, status may be incorrect for %s", package_name); |
814 | } | 814 | } |
815 | } | 815 | } |
816 | else if (strcmp("not-installed", name_hashtable[state_status]) == 0) { | 816 | else if (strcmp("not-installed", name_hashtable[state_status]) == 0) { |
@@ -881,15 +881,15 @@ void write_status_file(deb_file_t **deb_file) | |||
881 | if (rename("/var/lib/dpkg/status", "/var/lib/dpkg/status.udeb.bak") == -1) { | 881 | if (rename("/var/lib/dpkg/status", "/var/lib/dpkg/status.udeb.bak") == -1) { |
882 | struct stat stat_buf; | 882 | struct stat stat_buf; |
883 | if (stat("/var/lib/dpkg/status", &stat_buf) == 0) { | 883 | if (stat("/var/lib/dpkg/status", &stat_buf) == 0) { |
884 | error_msg_and_die("Couldnt create backup status file"); | 884 | bb_error_msg_and_die("Couldnt create backup status file"); |
885 | } | 885 | } |
886 | /* Its ok if renaming the status file fails becasue status | 886 | /* Its ok if renaming the status file fails becasue status |
887 | * file doesnt exist, maybe we are starting from scratch */ | 887 | * file doesnt exist, maybe we are starting from scratch */ |
888 | error_msg("No status file found, creating new one"); | 888 | bb_error_msg("No status file found, creating new one"); |
889 | } | 889 | } |
890 | 890 | ||
891 | if (rename("/var/lib/dpkg/status.udeb", "/var/lib/dpkg/status") == -1) { | 891 | if (rename("/var/lib/dpkg/status.udeb", "/var/lib/dpkg/status") == -1) { |
892 | error_msg_and_die("DANGER: Couldnt create status file, you need to manually repair your status file"); | 892 | bb_error_msg_and_die("DANGER: Couldnt create status file, you need to manually repair your status file"); |
893 | } | 893 | } |
894 | } | 894 | } |
895 | 895 | ||
@@ -976,7 +976,7 @@ int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count) | |||
976 | } | 976 | } |
977 | 977 | ||
978 | if (result) { | 978 | if (result) { |
979 | error_msg_and_die("Package %s conflicts with %s", | 979 | bb_error_msg_and_die("Package %s conflicts with %s", |
980 | name_hashtable[package_node->name], | 980 | name_hashtable[package_node->name], |
981 | name_hashtable[package_edge->name]); | 981 | name_hashtable[package_edge->name]); |
982 | } | 982 | } |
@@ -1021,7 +1021,7 @@ int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count) | |||
1021 | } | 1021 | } |
1022 | 1022 | ||
1023 | if (result) { | 1023 | if (result) { |
1024 | error_msg_and_die("Package %s pre-depends on %s, but it is not installed", | 1024 | bb_error_msg_and_die("Package %s pre-depends on %s, but it is not installed", |
1025 | name_hashtable[package_node->name], | 1025 | name_hashtable[package_node->name], |
1026 | name_hashtable[package_edge->name]); | 1026 | name_hashtable[package_edge->name]); |
1027 | } | 1027 | } |
@@ -1038,7 +1038,7 @@ int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count) | |||
1038 | } | 1038 | } |
1039 | /* It must be already installed, or to be installed */ | 1039 | /* It must be already installed, or to be installed */ |
1040 | if (result) { | 1040 | if (result) { |
1041 | error_msg_and_die("Package %s depends on %s, but it is not installed, or flaged to be installed", | 1041 | bb_error_msg_and_die("Package %s depends on %s, but it is not installed, or flaged to be installed", |
1042 | name_hashtable[package_node->name], | 1042 | name_hashtable[package_node->name], |
1043 | name_hashtable[package_edge->name]); | 1043 | name_hashtable[package_edge->name]); |
1044 | } | 1044 | } |
@@ -1065,9 +1065,8 @@ char **create_list(const char *filename) | |||
1065 | return(NULL); | 1065 | return(NULL); |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | while ((line = get_line_from_file(list_stream)) != NULL) { | 1068 | while ((line = bb_get_chomped_line_from_file(list_stream)) != NULL) { |
1069 | file_list = xrealloc(file_list, sizeof(char *) * (count + 2)); | 1069 | file_list = xrealloc(file_list, sizeof(char *) * (count + 2)); |
1070 | chomp(line); | ||
1071 | file_list[count] = line; | 1070 | file_list[count] = line; |
1072 | count++; | 1071 | count++; |
1073 | } | 1072 | } |
@@ -1228,7 +1227,7 @@ void remove_package(const unsigned int package_num) | |||
1228 | /* run prerm script */ | 1227 | /* run prerm script */ |
1229 | return_value = run_package_script(package_name, "prerm"); | 1228 | return_value = run_package_script(package_name, "prerm"); |
1230 | if (return_value == -1) { | 1229 | if (return_value == -1) { |
1231 | error_msg_and_die("script failed, prerm failure"); | 1230 | bb_error_msg_and_die("script failed, prerm failure"); |
1232 | } | 1231 | } |
1233 | 1232 | ||
1234 | /* Create a list of files to remove, and a seperate list of those to keep */ | 1233 | /* Create a list of files to remove, and a seperate list of those to keep */ |
@@ -1245,7 +1244,7 @@ void remove_package(const unsigned int package_num) | |||
1245 | 1244 | ||
1246 | /* Create a list of files in /var/lib/dpkg/info/<package>.* to keep */ | 1245 | /* Create a list of files in /var/lib/dpkg/info/<package>.* to keep */ |
1247 | exclude_files = xmalloc(sizeof(char*) * 3); | 1246 | exclude_files = xmalloc(sizeof(char*) * 3); |
1248 | exclude_files[0] = xstrdup(conffile_name); | 1247 | exclude_files[0] = bb_xstrdup(conffile_name); |
1249 | exclude_files[1] = xmalloc(package_name_length + 27); | 1248 | exclude_files[1] = xmalloc(package_name_length + 27); |
1250 | sprintf(exclude_files[1], "/var/lib/dpkg/info/%s.postrm", package_name); | 1249 | sprintf(exclude_files[1], "/var/lib/dpkg/info/%s.postrm", package_name); |
1251 | exclude_files[2] = NULL; | 1250 | exclude_files[2] = NULL; |
@@ -1275,7 +1274,7 @@ void purge_package(const unsigned int package_num) | |||
1275 | 1274 | ||
1276 | /* run prerm script */ | 1275 | /* run prerm script */ |
1277 | if (run_package_script(package_name, "prerm") != 0) { | 1276 | if (run_package_script(package_name, "prerm") != 0) { |
1278 | error_msg_and_die("script failed, prerm failure"); | 1277 | bb_error_msg_and_die("script failed, prerm failure"); |
1279 | } | 1278 | } |
1280 | 1279 | ||
1281 | /* Create a list of files to remove */ | 1280 | /* Create a list of files to remove */ |
@@ -1297,7 +1296,7 @@ void purge_package(const unsigned int package_num) | |||
1297 | 1296 | ||
1298 | /* run postrm script */ | 1297 | /* run postrm script */ |
1299 | if (run_package_script(package_name, "postrm") == -1) { | 1298 | if (run_package_script(package_name, "postrm") == -1) { |
1300 | error_msg_and_die("postrm fialure.. set status to what?"); | 1299 | bb_error_msg_and_die("postrm fialure.. set status to what?"); |
1301 | } | 1300 | } |
1302 | 1301 | ||
1303 | /* Change package status */ | 1302 | /* Change package status */ |
@@ -1312,7 +1311,7 @@ static archive_handle_t *init_archive_deb_ar(const char *filename) | |||
1312 | /* Setup an ar archive handle that refers to the gzip sub archive */ | 1311 | /* Setup an ar archive handle that refers to the gzip sub archive */ |
1313 | ar_handle = init_handle(); | 1312 | ar_handle = init_handle(); |
1314 | ar_handle->filter = filter_accept_list_reassign; | 1313 | ar_handle->filter = filter_accept_list_reassign; |
1315 | ar_handle->src_fd = xopen(filename, O_RDONLY); | 1314 | ar_handle->src_fd = bb_xopen(filename, O_RDONLY); |
1316 | 1315 | ||
1317 | return(ar_handle); | 1316 | return(ar_handle); |
1318 | } | 1317 | } |
@@ -1420,7 +1419,7 @@ static void unpack_package(deb_file_t *deb_file) | |||
1420 | /* Run the preinst prior to extracting */ | 1419 | /* Run the preinst prior to extracting */ |
1421 | if (run_package_script(package_name, "preinst") != 0) { | 1420 | if (run_package_script(package_name, "preinst") != 0) { |
1422 | /* when preinst returns exit code != 0 then quit installation process */ | 1421 | /* when preinst returns exit code != 0 then quit installation process */ |
1423 | error_msg_and_die("subprocess pre-installation script returned error."); | 1422 | bb_error_msg_and_die("subprocess pre-installation script returned error."); |
1424 | } | 1423 | } |
1425 | 1424 | ||
1426 | /* Extract data.tar.gz to the root directory */ | 1425 | /* Extract data.tar.gz to the root directory */ |
@@ -1430,7 +1429,7 @@ static void unpack_package(deb_file_t *deb_file) | |||
1430 | 1429 | ||
1431 | /* Create the list file */ | 1430 | /* Create the list file */ |
1432 | strcat(info_prefix, "list"); | 1431 | strcat(info_prefix, "list"); |
1433 | out_stream = xfopen(info_prefix, "w"); | 1432 | out_stream = bb_xfopen(info_prefix, "w"); |
1434 | while (archive_handle->passed) { | 1433 | while (archive_handle->passed) { |
1435 | /* blindly skip over the leading '.' */ | 1434 | /* blindly skip over the leading '.' */ |
1436 | fputs(archive_handle->passed->data + 1, out_stream); | 1435 | fputs(archive_handle->passed->data + 1, out_stream); |
@@ -1457,7 +1456,7 @@ void configure_package(deb_file_t *deb_file) | |||
1457 | /* Run the postinst script */ | 1456 | /* Run the postinst script */ |
1458 | if (run_package_script(package_name, "postinst") != 0) { | 1457 | if (run_package_script(package_name, "postinst") != 0) { |
1459 | /* TODO: handle failure gracefully */ | 1458 | /* TODO: handle failure gracefully */ |
1460 | error_msg_and_die("postrm failure.. set status to what?"); | 1459 | bb_error_msg_and_die("postrm failure.. set status to what?"); |
1461 | } | 1460 | } |
1462 | /* Change status to reflect success */ | 1461 | /* Change status to reflect success */ |
1463 | set_status(status_num, "install", 1); | 1462 | set_status(status_num, "install", 1); |
@@ -1506,12 +1505,12 @@ int dpkg_main(int argc, char **argv) | |||
1506 | dpkg_opt |= dpkg_opt_filename; | 1505 | dpkg_opt |= dpkg_opt_filename; |
1507 | break; | 1506 | break; |
1508 | default: | 1507 | default: |
1509 | show_usage(); | 1508 | bb_show_usage(); |
1510 | } | 1509 | } |
1511 | } | 1510 | } |
1512 | /* check for non-otion argument if expected */ | 1511 | /* check for non-otion argument if expected */ |
1513 | if ((dpkg_opt == 0) || ((argc == optind) && !(dpkg_opt && dpkg_opt_list_installed))) { | 1512 | if ((dpkg_opt == 0) || ((argc == optind) && !(dpkg_opt && dpkg_opt_list_installed))) { |
1514 | show_usage(); | 1513 | bb_show_usage(); |
1515 | } | 1514 | } |
1516 | 1515 | ||
1517 | /* puts("(Reading database ... xxxxx files and directories installed.)"); */ | 1516 | /* puts("(Reading database ... xxxxx files and directories installed.)"); */ |
@@ -1538,13 +1537,13 @@ int dpkg_main(int argc, char **argv) | |||
1538 | init_archive_deb_control(archive_handle); | 1537 | init_archive_deb_control(archive_handle); |
1539 | deb_file[deb_count]->control_file = deb_extract_control_file_to_buffer(archive_handle, control_list); | 1538 | deb_file[deb_count]->control_file = deb_extract_control_file_to_buffer(archive_handle, control_list); |
1540 | if (deb_file[deb_count]->control_file == NULL) { | 1539 | if (deb_file[deb_count]->control_file == NULL) { |
1541 | error_msg_and_die("Couldnt extract control file"); | 1540 | bb_error_msg_and_die("Couldnt extract control file"); |
1542 | } | 1541 | } |
1543 | deb_file[deb_count]->filename = xstrdup(argv[optind]); | 1542 | deb_file[deb_count]->filename = bb_xstrdup(argv[optind]); |
1544 | package_num = fill_package_struct(deb_file[deb_count]->control_file); | 1543 | package_num = fill_package_struct(deb_file[deb_count]->control_file); |
1545 | 1544 | ||
1546 | if (package_num == -1) { | 1545 | if (package_num == -1) { |
1547 | error_msg("Invalid control file in %s", argv[optind]); | 1546 | bb_error_msg("Invalid control file in %s", argv[optind]); |
1548 | continue; | 1547 | continue; |
1549 | } | 1548 | } |
1550 | deb_file[deb_count]->package = (unsigned int) package_num; | 1549 | deb_file[deb_count]->package = (unsigned int) package_num; |
@@ -1574,7 +1573,7 @@ int dpkg_main(int argc, char **argv) | |||
1574 | search_name_hashtable(argv[optind]), | 1573 | search_name_hashtable(argv[optind]), |
1575 | search_name_hashtable("ANY"), VER_ANY); | 1574 | search_name_hashtable("ANY"), VER_ANY); |
1576 | if (package_hashtable[deb_file[deb_count]->package] == NULL) { | 1575 | if (package_hashtable[deb_file[deb_count]->package] == NULL) { |
1577 | error_msg_and_die("Package %s is uninstalled or unknown\n", argv[optind]); | 1576 | bb_error_msg_and_die("Package %s is uninstalled or unknown\n", argv[optind]); |
1578 | } | 1577 | } |
1579 | state_status = get_status(search_status_hashtable(name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]), 3); | 1578 | state_status = get_status(search_status_hashtable(name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]), 3); |
1580 | 1579 | ||
@@ -1582,13 +1581,13 @@ int dpkg_main(int argc, char **argv) | |||
1582 | if (dpkg_opt & dpkg_opt_remove) { | 1581 | if (dpkg_opt & dpkg_opt_remove) { |
1583 | if ((strcmp(name_hashtable[state_status], "not-installed") == 0) || | 1582 | if ((strcmp(name_hashtable[state_status], "not-installed") == 0) || |
1584 | (strcmp(name_hashtable[state_status], "config-files") == 0)) { | 1583 | (strcmp(name_hashtable[state_status], "config-files") == 0)) { |
1585 | error_msg_and_die("%s is already removed.", name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]); | 1584 | bb_error_msg_and_die("%s is already removed.", name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]); |
1586 | } | 1585 | } |
1587 | } | 1586 | } |
1588 | else if (dpkg_opt & dpkg_opt_purge) { | 1587 | else if (dpkg_opt & dpkg_opt_purge) { |
1589 | /* if package status is "conf-files" then its ok */ | 1588 | /* if package status is "conf-files" then its ok */ |
1590 | if (strcmp(name_hashtable[state_status], "not-installed") == 0) { | 1589 | if (strcmp(name_hashtable[state_status], "not-installed") == 0) { |
1591 | error_msg_and_die("%s is already purged.", name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]); | 1590 | bb_error_msg_and_die("%s is already purged.", name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]); |
1592 | } | 1591 | } |
1593 | } | 1592 | } |
1594 | } | 1593 | } |
@@ -1601,7 +1600,7 @@ int dpkg_main(int argc, char **argv) | |||
1601 | /* TODO: check dependencies before removing */ | 1600 | /* TODO: check dependencies before removing */ |
1602 | if ((dpkg_opt & dpkg_opt_force_ignore_depends) != dpkg_opt_force_ignore_depends) { | 1601 | if ((dpkg_opt & dpkg_opt_force_ignore_depends) != dpkg_opt_force_ignore_depends) { |
1603 | if (!check_deps(deb_file, 0, deb_count)) { | 1602 | if (!check_deps(deb_file, 0, deb_count)) { |
1604 | error_msg_and_die("Dependency check failed"); | 1603 | bb_error_msg_and_die("Dependency check failed"); |
1605 | } | 1604 | } |
1606 | } | 1605 | } |
1607 | 1606 | ||