aboutsummaryrefslogtreecommitdiff
path: root/archival/libunarchive/get_header_ar.c
diff options
context:
space:
mode:
Diffstat (limited to 'archival/libunarchive/get_header_ar.c')
-rw-r--r--archival/libunarchive/get_header_ar.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/archival/libunarchive/get_header_ar.c b/archival/libunarchive/get_header_ar.c
index 1e0e6c12d..6c576a8da 100644
--- a/archival/libunarchive/get_header_ar.c
+++ b/archival/libunarchive/get_header_ar.c
@@ -41,7 +41,7 @@ extern char get_header_ar(archive_handle_t *archive_handle)
41 static unsigned int ar_long_name_size; 41 static unsigned int ar_long_name_size;
42#endif 42#endif
43 43
44 /* dont use xread as we want to handle the error ourself */ 44 /* dont use bb_xread as we want to handle the error ourself */
45 if (read(archive_handle->src_fd, ar.raw, 60) != 60) { 45 if (read(archive_handle->src_fd, ar.raw, 60) != 60) {
46 /* End Of File */ 46 /* End Of File */
47 return(EXIT_FAILURE); 47 return(EXIT_FAILURE);
@@ -51,14 +51,14 @@ extern char get_header_ar(archive_handle_t *archive_handle)
51 if (ar.raw[0] == '\n') { 51 if (ar.raw[0] == '\n') {
52 /* fix up the header, we started reading 1 byte too early */ 52 /* fix up the header, we started reading 1 byte too early */
53 memmove(ar.raw, &ar.raw[1], 59); 53 memmove(ar.raw, &ar.raw[1], 59);
54 ar.raw[59] = xread_char(archive_handle->src_fd); 54 ar.raw[59] = bb_xread_char(archive_handle->src_fd);
55 archive_handle->offset++; 55 archive_handle->offset++;
56 } 56 }
57 archive_handle->offset += 60; 57 archive_handle->offset += 60;
58 58
59 /* align the headers based on the header magic */ 59 /* align the headers based on the header magic */
60 if ((ar.formated.magic[0] != '`') || (ar.formated.magic[1] != '\n')) { 60 if ((ar.formated.magic[0] != '`') || (ar.formated.magic[1] != '\n')) {
61 error_msg_and_die("Invalid ar header"); 61 bb_error_msg_and_die("Invalid ar header");
62 } 62 }
63 63
64 typed->mode = strtol(ar.formated.mode, NULL, 8); 64 typed->mode = strtol(ar.formated.mode, NULL, 8);
@@ -76,7 +76,7 @@ extern char get_header_ar(archive_handle_t *archive_handle)
76 * in static variable long_names for use in future entries */ 76 * in static variable long_names for use in future entries */
77 ar_long_name_size = typed->size; 77 ar_long_name_size = typed->size;
78 ar_long_names = xmalloc(ar_long_name_size); 78 ar_long_names = xmalloc(ar_long_name_size);
79 xread_all(archive_handle->src_fd, ar_long_names, ar_long_name_size); 79 bb_xread_all(archive_handle->src_fd, ar_long_names, ar_long_name_size);
80 archive_handle->offset += ar_long_name_size; 80 archive_handle->offset += ar_long_name_size;
81 /* This ar entries data section only contained filenames for other records 81 /* This ar entries data section only contained filenames for other records
82 * they are stored in the static ar_long_names for future reference */ 82 * they are stored in the static ar_long_names for future reference */
@@ -90,16 +90,16 @@ extern char get_header_ar(archive_handle_t *archive_handle)
90 (saved in variable long_name) that conatains the real filename */ 90 (saved in variable long_name) that conatains the real filename */
91 const unsigned int long_offset = atoi(&ar.formated.name[1]); 91 const unsigned int long_offset = atoi(&ar.formated.name[1]);
92 if (long_offset >= ar_long_name_size) { 92 if (long_offset >= ar_long_name_size) {
93 error_msg_and_die("Cant resolve long filename"); 93 bb_error_msg_and_die("Cant resolve long filename");
94 } 94 }
95 typed->name = xstrdup(ar_long_names + long_offset); 95 typed->name = bb_xstrdup(ar_long_names + long_offset);
96 } 96 }
97#else 97#else
98 error_msg_and_die("long filenames not supported"); 98 bb_error_msg_and_die("long filenames not supported");
99#endif 99#endif
100 } else { 100 } else {
101 /* short filenames */ 101 /* short filenames */
102 typed->name = xstrndup(ar.formated.name, 16); 102 typed->name = bb_xstrndup(ar.formated.name, 16);
103 } 103 }
104 104
105 typed->name[strcspn(typed->name, " /")] = '\0'; 105 typed->name[strcspn(typed->name, " /")] = '\0';