aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-07-18 03:13:49 +0000
committerbug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-07-18 03:13:49 +0000
commit05f9617dd182eb07450e5361fc6e91f58a8f2ed9 (patch)
treeca4cc7d1e1bb41545a1bd1a6d29abeb4be048e77
parentf5d85e22fb66502d2c600d91955e0498e8fd0f43 (diff)
downloadbusybox-w32-05f9617dd182eb07450e5361fc6e91f58a8f2ed9.tar.gz
busybox-w32-05f9617dd182eb07450e5361fc6e91f58a8f2ed9.tar.bz2
busybox-w32-05f9617dd182eb07450e5361fc6e91f58a8f2ed9.zip
Use xfopen to abort on error to prevent segfaulting later.
git-svn-id: svn://busybox.net/trunk/busybox@3115 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--archival/dpkg.c6
-rw-r--r--dpkg.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c
index 189b0a898..dcc3fad4e 100644
--- a/archival/dpkg.c
+++ b/archival/dpkg.c
@@ -643,7 +643,7 @@ void index_status_file(const char *filename)
643 status_node_t *status_node = NULL; 643 status_node_t *status_node = NULL;
644 unsigned int status_num; 644 unsigned int status_num;
645 645
646 status_file = fopen(filename, "r"); 646 status_file = xfopen(filename, "r");
647 while ((control_buffer = fgets_str(status_file, "\n\n")) != NULL) { 647 while ((control_buffer = fgets_str(status_file, "\n\n")) != NULL) {
648 const unsigned int package_num = fill_package_struct(control_buffer); 648 const unsigned int package_num = fill_package_struct(control_buffer);
649 if (package_num != -1) { 649 if (package_num != -1) {
@@ -1036,7 +1036,7 @@ char **create_list(const char *filename)
1036 int length = 0; 1036 int length = 0;
1037 int count = 0; 1037 int count = 0;
1038 1038
1039 list_stream = fopen(filename, "r"); 1039 list_stream = xfopen(filename, "r");
1040 if (list_stream == NULL) { 1040 if (list_stream == NULL) {
1041 return(NULL); 1041 return(NULL);
1042 } 1042 }
@@ -1246,7 +1246,7 @@ void unpack_package(deb_file_t *deb_file)
1246 /* Create the list file */ 1246 /* Create the list file */
1247 strcat(info_prefix, "list"); 1247 strcat(info_prefix, "list");
1248 1248
1249 out_stream = wfopen(info_prefix, "w"); 1249 out_stream = xfopen(info_prefix, "w");
1250 deb_extract(deb_file->filename, out_stream, (extract_quiet | extract_data_tar_gz | extract_list), NULL, NULL); 1250 deb_extract(deb_file->filename, out_stream, (extract_quiet | extract_data_tar_gz | extract_list), NULL, NULL);
1251 fclose(out_stream); 1251 fclose(out_stream);
1252 1252
diff --git a/dpkg.c b/dpkg.c
index 189b0a898..dcc3fad4e 100644
--- a/dpkg.c
+++ b/dpkg.c
@@ -643,7 +643,7 @@ void index_status_file(const char *filename)
643 status_node_t *status_node = NULL; 643 status_node_t *status_node = NULL;
644 unsigned int status_num; 644 unsigned int status_num;
645 645
646 status_file = fopen(filename, "r"); 646 status_file = xfopen(filename, "r");
647 while ((control_buffer = fgets_str(status_file, "\n\n")) != NULL) { 647 while ((control_buffer = fgets_str(status_file, "\n\n")) != NULL) {
648 const unsigned int package_num = fill_package_struct(control_buffer); 648 const unsigned int package_num = fill_package_struct(control_buffer);
649 if (package_num != -1) { 649 if (package_num != -1) {
@@ -1036,7 +1036,7 @@ char **create_list(const char *filename)
1036 int length = 0; 1036 int length = 0;
1037 int count = 0; 1037 int count = 0;
1038 1038
1039 list_stream = fopen(filename, "r"); 1039 list_stream = xfopen(filename, "r");
1040 if (list_stream == NULL) { 1040 if (list_stream == NULL) {
1041 return(NULL); 1041 return(NULL);
1042 } 1042 }
@@ -1246,7 +1246,7 @@ void unpack_package(deb_file_t *deb_file)
1246 /* Create the list file */ 1246 /* Create the list file */
1247 strcat(info_prefix, "list"); 1247 strcat(info_prefix, "list");
1248 1248
1249 out_stream = wfopen(info_prefix, "w"); 1249 out_stream = xfopen(info_prefix, "w");
1250 deb_extract(deb_file->filename, out_stream, (extract_quiet | extract_data_tar_gz | extract_list), NULL, NULL); 1250 deb_extract(deb_file->filename, out_stream, (extract_quiet | extract_data_tar_gz | extract_list), NULL, NULL);
1251 fclose(out_stream); 1251 fclose(out_stream);
1252 1252