[BusyBox-cvs] busybox/archival ar.c,1.44,1.45 tar.c,1.184,1.185
Glenn McGrath
bug1 at busybox.net
Fri Nov 21 22:24:50 UTC 2003
- Previous message: [BusyBox-cvs] busybox/archival/libunarchive uncompress.c,1.8,1.9
- Next message: [BusyBox-cvs] busybox/archival/libunarchive Makefile.in, 1.20, 1.21 archive_xread_all.c, 1.2, 1.3 archive_xread_all_eof.c, 1.2, 1.3 data_extract_all.c, 1.15, 1.16 data_extract_to_stdout.c, 1.2, 1.3 get_header_tar.c, 1.28, 1.29 seek_by_char.c, 1.2, 1.3 archive_copy_file.c, 1.4, NONE archive_xread.c, 1.4, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/cvs/busybox/archival
In directory winder:/tmp/cvs-serv3728/archival
Modified Files:
ar.c tar.c
Log Message:
As we no longer use function pointers for read in common archiving code
archive_xread can be replaced with bb_full_read, and archive_copy_file
with bb_copyfd*
bb_copyfd is split into two functions bb_copyfd_size and bb_copyfd_eof,
they share a common backend.
Index: ar.c
===================================================================
RCS file: /var/cvs/busybox/archival/ar.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- ar.c 19 Mar 2003 09:11:21 -0000 1.44
+++ ar.c 21 Nov 2003 22:24:45 -0000 1.45
@@ -59,7 +59,7 @@
file_header = archive_handle->file_header;
dst_fd = bb_xopen(file_header->name, O_WRONLY | O_CREAT);
- archive_copy_file(archive_handle, dst_fd);
+ bb_copyfd_eof(archive_handle->src_fd, dst_fd, file_header->size);
close(dst_fd);
chmod(file_header->name, file_header->mode);
Index: tar.c
===================================================================
RCS file: /var/cvs/busybox/archival/tar.c,v
retrieving revision 1.184
retrieving revision 1.185
diff -u -d -r1.184 -r1.185
--- tar.c 20 Nov 2003 10:46:58 -0000 1.184
+++ tar.c 21 Nov 2003 22:24:45 -0000 1.185
@@ -414,8 +414,7 @@
if ((tbInfo->hlInfo == NULL)
&& (S_ISREG(statbuf->st_mode))) {
int inputFileFd;
- char buffer[BUFSIZ];
- ssize_t size = 0, readSize = 0;
+ ssize_t readSize = 0;
/* open the file we want to archive, and make sure all is well */
if ((inputFileFd = open(fileName, O_RDONLY)) < 0) {
@@ -424,18 +423,8 @@
}
/* write the file to the archive */
- while ((size = bb_full_read(inputFileFd, buffer, sizeof(buffer))) > 0) {
- if (bb_full_write(tbInfo->tarFd, buffer, size) != size) {
- /* Output file seems to have a problem */
- bb_error_msg(bb_msg_io_error, fileName);
- return (FALSE);
- }
- readSize += size;
- }
- if (size == -1) {
- bb_error_msg(bb_msg_io_error, fileName);
- return (FALSE);
- }
+ readSize = bb_copyfd_eof(inputFileFd, tbInfo->tarFd);
+
/* Pad the file up to the tar block size */
for (; (readSize % TAR_BLOCK_SIZE) != 0; readSize++) {
write(tbInfo->tarFd, "\0", 1);
- Previous message: [BusyBox-cvs] busybox/archival/libunarchive uncompress.c,1.8,1.9
- Next message: [BusyBox-cvs] busybox/archival/libunarchive Makefile.in, 1.20, 1.21 archive_xread_all.c, 1.2, 1.3 archive_xread_all_eof.c, 1.2, 1.3 data_extract_all.c, 1.15, 1.16 data_extract_to_stdout.c, 1.2, 1.3 get_header_tar.c, 1.28, 1.29 seek_by_char.c, 1.2, 1.3 archive_copy_file.c, 1.4, NONE archive_xread.c, 1.4, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the busybox-cvs
mailing list