FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Kernel

 
 
LinkBack Thread Tools
 
Old 05-18-2010, 12:15 PM
Martin Sivak
 
Default Fix the order of arguments in archive read callback and archive closing.

libarchive read callback returns number of bytes, but Fread returns number of read blocks. This caused Unrecognized archive format errors, because the decompressed archive was truncated.

Also libarchive takes care of closing the input stream using the close callback, so we must not do it ourselves..

Related: rhbz#508242
---
loader/rpmextract.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/loader/rpmextract.c b/loader/rpmextract.c
index 0d99a38..fafe46e 100644
--- a/loader/rpmextract.c
+++ b/loader/rpmextract.c
@@ -57,7 +57,7 @@ ssize_t rpm_myread(struct archive *a, void *client_data, const void **buff)
{
struct cpio_mydata *mydata = client_data;
*buff = mydata->buffer;
- return Fread(mydata->buffer, BUFFERSIZE, 1, mydata->gzdi);
+ return Fread(mydata->buffer, 1, BUFFERSIZE, mydata->gzdi);
}

int rpm_myclose(struct archive *a, void *client_data)
@@ -230,7 +230,7 @@ int explodeRPM(const char *source,
free(rpmio_flags);

if (gzdi == NULL) {
- logMessage(ERROR, "cannot re-open payload: %s
", Fstrerror(gzdi));
+ logMessage(ERROR, "cannot re-open payload: %s", Fstrerror(gzdi));
return EXIT_FAILURE;
}

@@ -345,8 +345,7 @@ int explodeRPM(const char *source,
archive_read_data_skip(cpio);
}

- archive_read_finish(cpio);
- Fclose(gzdi);
+ rc = archive_read_finish(cpio); /* Also closes the RPM stream using callback */

return rc != ARCHIVE_OK;
}
--
1.6.6.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 05-18-2010, 12:36 PM
Ales Kozumplik
 
Default Fix the order of arguments in archive read callback and archive closing.

On 05/18/2010 02:15 PM, Martin Sivak wrote:

libarchive read callback returns number of bytes, but Fread returns number of read blocks. This caused Unrecognized archive format errors, because the decompressed archive was truncated.

Also libarchive takes care of closing the input stream using the close callback, so we must not do it ourselves..

Related: rhbz#508242
---


Also Ack.

Ales

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 01:18 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org