Package: cramfsswap
Version: 1.3.1
Severity: normal
Tags: patch

Hi,

The source of present cramfsswap doesn't support 4096 numbers or
more of files.
It makes an error of cramfsswap when 4096 more files are in cramfs.
I wrote patch to solve this problem.
Could you apply this patch?

regards,
 Nobuhiro

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.22 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=ja_JP.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages cramfsswap depends on:
ii  libc6                   2.6.1-1          GNU C Library: Shared libraries
ii  zlib1g                  1:1.2.3.3.dfsg-5 compression library - runtime

cramfsswap recommends no packages.

-- no debconf information


-- 
Nobuhiro Iwamatsu
        [EMAIL PROTECTED]
        [EMAIL PROTECTED]

        GPG ID : 3170EBE9
--- cramfsswap.c.orig	2007-08-29 21:13:45.000000000 +0900
+++ cramfsswap.c	2007-08-29 21:27:02.000000000 +0900
@@ -33,8 +33,8 @@
   uint8_t	        inode_in[12], inode_out[12];
   struct cramfs_inode	inode;
   unsigned int		filecnt, file, filepos, remaining, nblocks,
-                        fileoffset[MAXFILES], filesize[MAXFILES],
                         copybytes, readbytes, x;
+  unsigned int 		*fileoffset, *filesize;
   unsigned char		buffer[BUFFERSIZE], is_hostorder, host_is_le, file_is_le;
   int			infile, outfile;
   int			size;
@@ -154,6 +154,19 @@
     filecnt = superblock_out[11];
   printf("Filesystem contains %d files.\n", filecnt-1);
 
+  fileoffset = (unsigned int*)malloc( filecnt * sizeof( *fileoffset ));
+  if( fileoffset == NULL ){
+      perror("fileoffset malloc error");
+      exit(1);
+  }
+
+  filesize = (unsigned int*)malloc( filecnt * sizeof( *filesize ));
+  if( filesize == NULL ){
+      free( fileoffset ); fileoffset = NULL;
+      perror("filesize malloc error");
+      exit(1);
+  }
+
   /* Set filepos (in words) */
   filepos = 16;
 
@@ -334,7 +347,7 @@
   if (mapping != MAP_FAILED) {
     crc = crc32(0L, Z_NULL, 0);
     mapping[8] = is_hostorder?bswap_32(crc):crc;
-    crc = crc32(crc, (char *)mapping, size);
+    crc = crc32(crc, (unsigned char *)mapping, size);
     printf("CRC: 0x%08x\n", crc);
     mapping[8] = is_hostorder?bswap_32(crc):crc;
     munmap(mapping, size);

Attachment: pgpzu31jVC6di.pgp
Description: PGP signature

Reply via email to