Skip to content

Commit

Permalink
ubifs: BUG: Blocks commpressed with zlib
Browse files Browse the repository at this point in the history
Blocks compressed with zlib dont have the full gzip header.

Without this patch, block compressed with zlib cannot be readed!

Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
  • Loading branch information
Ricardo Ribalda Delgado authored and wdenx committed Apr 30, 2009
1 parent 35f6a94 commit c1a0fd5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions fs/ubifs/ubifs.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/

#include "ubifs.h"
#include <u-boot/zlib.h>

#if !defined(CONFIG_SYS_64BIT_VSPRINTF)
#warning Please define CONFIG_SYS_64BIT_VSPRINTF for correct output!
Expand All @@ -34,14 +35,14 @@ DECLARE_GLOBAL_DATA_PTR;
/* compress.c */

/*
* We need a wrapper for gunzip() because the parameters are
* We need a wrapper for zunzip() because the parameters are
* incompatible with the lzo decompressor.
*/
static int gzip_decompress(const unsigned char *in, size_t in_len,
unsigned char *out, size_t *out_len)
{
unsigned long len = in_len;
return gunzip(out, *out_len, (unsigned char *)in, &len);
return zunzip(out, *out_len, (unsigned char *)in, &len, 0, 0);
}

/* Fake description object for the "none" compressor */
Expand Down
3 changes: 2 additions & 1 deletion fs/ubifs/ubifs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2172,6 +2172,7 @@ int ubifs_decompress(const void *buf, int len, void *out, int *out_len,
/* todo: Move these to a common U-Boot header */
int lzo1x_decompress_safe(const unsigned char *in, size_t in_len,
unsigned char *out, size_t *out_len);
int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp);

int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp,
int stoponerr, int offset);
#endif /* !__UBIFS_H__ */

0 comments on commit c1a0fd5

Please sign in to comment.