summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2001-07-18 03:13:49 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2001-07-18 03:13:49 +0000
commit4cdc607f728f94bcbd14823281af362a38cc3c79 (patch)
treeca4cc7d1e1bb41545a1bd1a6d29abeb4be048e77
parentbc4c0300238c62c9daa8dcd8ac8eff028bf314a0 (diff)
Use xfopen to abort on error to prevent segfaulting later.
-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)
status_node_t *status_node = NULL;
unsigned int status_num;
- status_file = fopen(filename, "r");
+ status_file = xfopen(filename, "r");
while ((control_buffer = fgets_str(status_file, "\n\n")) != NULL) {
const unsigned int package_num = fill_package_struct(control_buffer);
if (package_num != -1) {
@@ -1036,7 +1036,7 @@ char **create_list(const char *filename)
int length = 0;
int count = 0;
- list_stream = fopen(filename, "r");
+ list_stream = xfopen(filename, "r");
if (list_stream == NULL) {
return(NULL);
}
@@ -1246,7 +1246,7 @@ void unpack_package(deb_file_t *deb_file)
/* Create the list file */
strcat(info_prefix, "list");
- out_stream = wfopen(info_prefix, "w");
+ out_stream = xfopen(info_prefix, "w");
deb_extract(deb_file->filename, out_stream, (extract_quiet | extract_data_tar_gz | extract_list), NULL, NULL);
fclose(out_stream);
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)
status_node_t *status_node = NULL;
unsigned int status_num;
- status_file = fopen(filename, "r");
+ status_file = xfopen(filename, "r");
while ((control_buffer = fgets_str(status_file, "\n\n")) != NULL) {
const unsigned int package_num = fill_package_struct(control_buffer);
if (package_num != -1) {
@@ -1036,7 +1036,7 @@ char **create_list(const char *filename)
int length = 0;
int count = 0;
- list_stream = fopen(filename, "r");
+ list_stream = xfopen(filename, "r");
if (list_stream == NULL) {
return(NULL);
}
@@ -1246,7 +1246,7 @@ void unpack_package(deb_file_t *deb_file)
/* Create the list file */
strcat(info_prefix, "list");
- out_stream = wfopen(info_prefix, "w");
+ out_stream = xfopen(info_prefix, "w");
deb_extract(deb_file->filename, out_stream, (extract_quiet | extract_data_tar_gz | extract_list), NULL, NULL);
fclose(out_stream);