The new command "grub-fstest" may not work for large image files or /dev/sdX devices on 32-bit platforms.

Legacy C89 functions fseek() and ftell() always use "long" as offset type. The attached patch changes this to fseeko() and ftello() which use off_t. These are part of POSIX, so new ./configure stuff should be not necessary.

Christian

2008-02-07  Christian Franke  <[EMAIL PROTECTED]>

        * util/hostfs.c (grub_hostfs_open): Use fseeko and ftello
        instead of fseek and ftell to support large files.
        (grub_hostfs_read): Likewise.


--- grub2.orig/util/hostfs.c	2007-11-18 17:57:02.531250000 +0100
+++ grub2/util/hostfs.c	2008-02-07 21:44:25.531250000 +0100
@@ -100,9 +100,9 @@ grub_hostfs_open (struct grub_file *file
 		       "can't open `%s'", name);
   file->data = f;
 
-  fseek (f, 0, SEEK_END);
-  file->size = ftell (f);
-  fseek (f, 0, SEEK_SET);
+  fseeko (f, 0, SEEK_END);
+  file->size = ftello (f);
+  fseeko (f, 0, SEEK_SET);
 
   return GRUB_ERR_NONE;
 }
@@ -113,7 +113,7 @@ grub_hostfs_read (grub_file_t file, char
   FILE *f;
 
   f = (FILE *) file->data;
-  fseek (f, file->offset, SEEK_SET);
+  fseeko (f, file->offset, SEEK_SET);
   int s = fread (buf, 1, len, f);
 
   return s;
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to