]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Fix compiling under diet libc
authorTheodore Ts'o <tytso@mit.edu>
Fri, 12 Sep 2008 13:10:39 +0000 (09:10 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 12 Sep 2008 13:10:39 +0000 (09:10 -0400)
Some recent changes had caused diet libc support to bitrot.  Fix up
missing header files and other portability fixups needed for dietlibc.
(Many of these changes also improve general portability.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
13 files changed:
e2fsck/Makefile.in
e2fsck/crc32.c
e2fsck/ea_refcount.c
e2fsck/message.c
e2fsck/pass1.c
e2fsck/region.c
intl/dcigettext.c
intl/l10nflist.c
lib/ext2fs/crc16.c
lib/ext2fs/crc16.h
lib/ext2fs/csum.c
lib/ext2fs/tst_csum.c
tests/test_config

index fe0fab52f44717a8be122acee9d047f9bef52b1c..77300d18c7df94ceea568df53b044f3f44565d63 100644 (file)
@@ -141,7 +141,7 @@ tst_crc32: $(srcdir)/crc32.c $(LIBEXT2FS)
 tst_refcount: ea_refcount.c
        @echo " LD $@"
        @$(CC) -o tst_refcount $(srcdir)/ea_refcount.c \
-               $(ALL_CFLAGS) -DTEST_PROGRAM $(LIBCOM_ERR)
+               $(ALL_CFLAGS) -DTEST_PROGRAM $(LIBCOM_ERR) $(LIBEXT2FS) 
 
 tst_region: region.c
        @echo " LD $@"
index f46295e1217f24732ab2e3487239196943e48760..f092c03a5049d8e3d77cd84a4c967d87bb10ff6b 100644 (file)
@@ -36,6 +36,9 @@
 #include <string.h>
 #include <ctype.h>
 
+#ifdef UNITTEST
+#undef ENABLE_NLS
+#endif
 #include "e2fsck.h"
 
 #include "crc32defs.h"
index daaedc4b7d938cf3d40097dffe73cfc076247451..39f2db7fc6c5b5f623978ce7ef09ce71cb9431be 100644 (file)
@@ -11,6 +11,9 @@
 #include <string.h>
 #include <stdio.h>
 
+#ifdef TEST_PROGRAM
+#undef ENABLE_NLS
+#endif
 #include "e2fsck.h"
 
 /*
index f79b73c457b1699358d6ddb4f1733d362a7a037a..5158ed64c4f587d04b2bca1ce10073fbd79a2a8c 100644 (file)
@@ -246,7 +246,7 @@ static _INLINE_ void expand_inode_expression(char ch,
        struct ext2_inode_large *large_inode;
        const char *            time_str;
        time_t                  t;
-       int                     do_gmt = -1;
+       static int              do_gmt = -1;
 
        if (!ctx || !ctx->inode)
                goto no_inode;
@@ -289,15 +289,17 @@ static _INLINE_ void expand_inode_expression(char ch,
                printf("0%o", inode->i_mode);
                break;
        case 'M':
+#ifdef __dietlibc__
                /* The diet libc doesn't respect the TZ environemnt variable */
                if (do_gmt == -1) {
                        time_str = getenv("TZ");
                        if (!time_str)
                                time_str = "";
-                       do_gmt = !strcmp(time_str, "GMT");
+                       do_gmt = !strcmp(time_str, "GMT0");
                }
+#endif
                t = inode->i_mtime;
-               time_str = asctime(do_gmt ? gmtime(&t) : localtime(&t));
+               time_str = asctime((do_gmt > 0) ? gmtime(&t) : localtime(&t));
                printf("%.24s", time_str);
                break;
        case 'F':
index 8bbf7febc8b3d2d7fd234970c6ce76b286a68a86..8ad08715b82307f8088acff105227ae038564d62 100644 (file)
@@ -1206,6 +1206,8 @@ static EXT2_QSORT_TYPE process_inode_cmp(const void *a, const void *b)
               ib_b->inode.i_block[EXT2_IND_BLOCK]);
        if (ret == 0)
                ret = ib_a->inode.i_file_acl - ib_b->inode.i_file_acl;
+       if (ret == 0)
+               ret = ib_a->ino - ib_b->ino;
        return ret;
 }
 
index 0cec6a92246270d5d5cac4b566c415d3a2889b6e..e50c8a4487cd2f0d9985fac1315101d981ed54d5 100644 (file)
@@ -14,6 +14,9 @@
 #endif
 #include <string.h>
 
+#ifdef TEST_PROGRAM
+#undef ENABLE_NLS
+#endif
 #include "e2fsck.h"
 
 struct region_el {
index a4452f7a6ae62713a4bdf8c19f2f6678a1e9a334..79678cf8963ecf9b31437db4dda6761b6aab6815 100644 (file)
@@ -155,6 +155,7 @@ char *getcwd ();
 #  endif
 # endif
 # ifndef HAVE_STPCPY
+#define stpcpy(dest, src) my_stpcpy(dest, src)
 static char *stpcpy (char *dest, const char *src);
 # endif
 # ifndef HAVE_MEMPCPY
index 40b0249b06ab70959ac69bffd6f87ee55148314c..3393ecb5f5edf4960684bef124686e07a56dd4f8 100644 (file)
@@ -58,6 +58,7 @@
 # endif
 #else
 # ifndef HAVE_STPCPY
+#define stpcpy(dest, src) my_stpcpy(dest, src)
 static char *stpcpy (char *dest, const char *src);
 # endif
 #endif
index 86091a410e814c4b0e9aea9ed26c7146218c2ef3..026f040b63175e6f7b9765964e61732a8963e871 100644 (file)
@@ -5,6 +5,11 @@
  * Version 2. See the file COPYING for more details.
  */
 
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#include <ext2fs/ext2_types.h>
+
 #include "crc16.h"
 
 /** CRC table for the CRC-16. The poly is 0x8005 (x16 + x15 + x2 + 1) */
index e3d8b4a517da19156ac7f90d03a616797a23173e..322e68dde39e7f8357f8380946aa036ec9c47fba 100644 (file)
@@ -15,8 +15,6 @@
 #ifndef __CRC16_H
 #define __CRC16_H
 
-#include <ext2fs/ext2_types.h>
-
 /* for an unknown reason, PPC treats __u16 as signed and keeps doing sign
  * extension on the value.  Instead, use only the low 16 bits of an
  * unsigned int for holding the CRC value to avoid this.
index 459c3c08f62544d9794465962dc700eae38c0e97..0f01919c5b47f8273a500c2bedc356426d0d8a47 100644 (file)
@@ -9,6 +9,10 @@
  * %End-Header%
  */
 
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
 #include "ext2_fs.h"
 #include "ext2fs.h"
 #include "crc16.h"
index 7a91b194c41e5c46c43cc3aaed0df287f5e9c16d..d8816b3061e03c77e2e7f7126116a2ab2c409b9e 100644 (file)
@@ -9,6 +9,10 @@
  * %End-Header%
  */
 
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
 #include "ext2fs/ext2_fs.h"
 #include "ext2fs/ext2fs.h"
 #include "ext2fs/crc16.h"
index 3710d56dc8dd948fd91cfa0b771d775423335398..45130bad8d3b75b3c622fcf5f352faf5aec401b4 100644 (file)
@@ -21,7 +21,7 @@ DYLD_LIBRARY_PATH=../lib:../lib/ext2fs:../lib/e2p:../lib/et:../lib/ss
 TMPFILE=./test.img
 export LD_LIBRARY_PATH
 export DYLD_LIBRARY_PATH
-TZ=GMT
+TZ=GMT0
 export TZ
 LC_ALL=C
 export LC_ALL