Whamcloud - gitweb
Add missing backwards compatibility for ancient Linux systems
authorTheodore Ts'o <tytso@mit.edu>
Mon, 29 May 2006 15:06:16 +0000 (11:06 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 29 May 2006 15:06:16 +0000 (11:06 -0400)
This fixes some (but not all) of the compatibility bugs which prevented
e2fsprogs from being compiled on a Linux 2.0.35 system.  There are still
some unprotected use of long long's, and apparently some type problems
with the uuid library, but these can be fixed up later.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
debugfs/ChangeLog
debugfs/util.c
e2fsck/ChangeLog
e2fsck/pass1b.c
misc/ChangeLog
misc/filefrag.c

index faca4a5..3373908 100644 (file)
@@ -1,3 +1,10 @@
+2006-05-29  Theodore Tso  <tytso@mit.edu>
+
+       * util.c (reset_getopt): In order to support ancient Linux header
+               files that don't define __GLIBC__ (but which were using
+               glibc anyway), assume that any system that defines
+               __linux__ should use the glibc method of resetting getopt().
+
 2006-05-28  Theodore Tso  <tytso@mit.edu>
 
        * unused.c (do_dump_unused): Use EXT2_MAX_BLOCK_SIZE instead of a
index cbbc99b..c6096ab 100644 (file)
@@ -37,7 +37,7 @@ extern int optreset;          /* defined by BSD, but not others */
  * optind be set zero to reset its state.  So the unfortunate state of
  * affairs is that BSD-derived versions of getopt() misbehave if
  * optind is set to 0 in order to reset getopt(), and glibc's getopt()
- * will core ump if optind is set 1 in order to reset getopt().
+ * will core dump if optind is set 1 in order to reset getopt().
  * 
  * More modern versions of BSD require that optreset be set to 1 in
  * order to reset getopt().   Sigh.  Standards, anyone?
@@ -46,7 +46,7 @@ extern int optreset;          /* defined by BSD, but not others */
  */
 void reset_getopt(void)
 {
-#ifdef __GLIBC__
+#if defined(__GLIBC__) || defined(__linux__)
        optind = 0;
 #else
        optind = 1;
index 6f21380..6f2a735 100644 (file)
@@ -1,3 +1,7 @@
+2006-05-29  Theodore Tso  <tytso@mit.edu>
+
+       * pass1b.c: Add missing semicolon when HAVE_INTPTR_T is not defined
+
 2006-05-22  Theodore Tso  <tytso@mit.edu>
 
        * e2fsck.8.in: Fixed spelling mistake.  (Addresses Debian Bug:
index 2b02b47..a9640ff 100644 (file)
@@ -37,7 +37,7 @@
 #endif
 
 #ifndef HAVE_INTPTR_T
-typedef long intptr_t
+typedef long intptr_t;
 #endif
 
 /* Needed for architectures where sizeof(int) != sizeof(void *) */
index 7e34cd4..a3fdf5b 100644 (file)
@@ -1,3 +1,8 @@
+2006-05-29  Theodore Tso  <tytso@mit.edu>
+
+       * filefrag.c: Add support for ancient Linux systems that do not
+               support the LFS api.
+
 2006-05-28  Theodore Tso  <tytso@mit.edu>
 
        * mke2fs.8.in (types): Clarify -T option description.
index 0a8b29d..5d144ff 100644 (file)
@@ -69,7 +69,11 @@ static unsigned long get_bmap(int fd, unsigned long block)
 static void frag_report(const char *filename)
 {
        struct statfs   fsinfo;
+#ifdef HAVE_FSTAT64
        struct stat64   fileinfo;
+#else
+       struct stat     fileinfo;
+#endif
        int             bs;
        long            i, fd;
        unsigned long   block, last_block = 0, numblocks;
@@ -83,7 +87,11 @@ static void frag_report(const char *filename)
                perror("statfs");
                return;
        }
+#ifdef HAVE_FSTAT64
        if (stat64(filename, &fileinfo) < 0) {
+#else
+       if (stat(filename, &fileinfo) < 0) {
+#endif
                perror("stat");
                return;
        }
@@ -102,7 +110,11 @@ static void frag_report(const char *filename)
                printf("Filesystem cylinder groups is approximately %ld\n", 
                       cylgroups);
        }
-       fd = open(filename, O_RDONLY | O_LARGEFILE);
+#ifdef HAVE_OPEN64
+       fd = open64(filename, O_RDONLY);
+#else
+       fd = open(filename, O_RDONLY);
+#endif
        if (fd < 0) {
                perror("open");
                return;