Add missing backwards compatibility for ancient Linux systems

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>
This commit is contained in:
Theodore Ts'o 2006-05-29 11:06:16 -04:00
parent 2c83031791
commit 9c07dc00b8
6 changed files with 32 additions and 4 deletions

View 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

View 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;

View 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:

View 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 *) */

View 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.

View 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;