rpm2cpio: handle unseekable input correctly

function                                             old     new   delta
data_skip                                             14      20      +6
seek_by_jump                                          67      72      +5
data_align                                            81      84      +3
seek_by_read                                          20      19      -1
skip_header                                           99      94      -5
rpm2cpio_main                                        183     177      -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/3 up/down: 14/-12)              Total: 2 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2009-08-28 21:09:51 +02:00
parent 7f2149489f
commit 0a130d510d
6 changed files with 22 additions and 19 deletions

View File

@@ -9,8 +9,8 @@
/* If we are reading through a pipe, or from stdin then we can't lseek,
* we must read and discard the data to skip over it.
*/
void FAST_FUNC seek_by_read(const archive_handle_t *archive_handle, unsigned jump_size)
void FAST_FUNC seek_by_read(int fd, off_t amount)
{
if (jump_size)
bb_copyfd_exact_size(archive_handle->src_fd, -1, jump_size);
if (amount)
bb_copyfd_exact_size(fd, -1, amount);
}