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:
tst_refcount: ea_refcount.c
@echo " LD $@"
@$(CC) -o tst_refcount $(srcdir)/ea_refcount.c \
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 $@"
tst_region: region.c
@echo " LD $@"
#include <string.h>
#include <ctype.h>
#include <string.h>
#include <ctype.h>
+#ifdef UNITTEST
+#undef ENABLE_NLS
+#endif
#include "e2fsck.h"
#include "crc32defs.h"
#include "e2fsck.h"
#include "crc32defs.h"
#include <string.h>
#include <stdio.h>
#include <string.h>
#include <stdio.h>
+#ifdef TEST_PROGRAM
+#undef ENABLE_NLS
+#endif
struct ext2_inode_large *large_inode;
const char * time_str;
time_t t;
struct ext2_inode_large *large_inode;
const char * time_str;
time_t t;
+ static int do_gmt = -1;
if (!ctx || !ctx->inode)
goto no_inode;
if (!ctx || !ctx->inode)
goto no_inode;
printf("0%o", inode->i_mode);
break;
case 'M':
printf("0%o", inode->i_mode);
break;
case 'M':
/* The diet libc doesn't respect the TZ environemnt variable */
if (do_gmt == -1) {
time_str = getenv("TZ");
if (!time_str)
time_str = "";
/* 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");
- 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':
printf("%.24s", time_str);
break;
case 'F':
ib_b->inode.i_block[EXT2_IND_BLOCK]);
if (ret == 0)
ret = ib_a->inode.i_file_acl - ib_b->inode.i_file_acl;
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;
#endif
#include <string.h>
#endif
#include <string.h>
+#ifdef TEST_PROGRAM
+#undef ENABLE_NLS
+#endif
#include "e2fsck.h"
struct region_el {
#include "e2fsck.h"
struct region_el {
# endif
# endif
# ifndef HAVE_STPCPY
# 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
static char *stpcpy (char *dest, const char *src);
# endif
# ifndef HAVE_MEMPCPY
# endif
#else
# ifndef HAVE_STPCPY
# endif
#else
# ifndef HAVE_STPCPY
+#define stpcpy(dest, src) my_stpcpy(dest, src)
static char *stpcpy (char *dest, const char *src);
# endif
#endif
static char *stpcpy (char *dest, const char *src);
# endif
#endif
* Version 2. See the file COPYING for more details.
*/
* 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) */
#include "crc16.h"
/** CRC table for the CRC-16. The poly is 0x8005 (x16 + x15 + x2 + 1) */
#ifndef __CRC16_H
#define __CRC16_H
#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.
/* 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.
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
#include "ext2_fs.h"
#include "ext2fs.h"
#include "crc16.h"
#include "ext2_fs.h"
#include "ext2fs.h"
#include "crc16.h"
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
#include "ext2fs/ext2_fs.h"
#include "ext2fs/ext2fs.h"
#include "ext2fs/crc16.h"
#include "ext2fs/ext2_fs.h"
#include "ext2fs/ext2fs.h"
#include "ext2fs/crc16.h"
TMPFILE=./test.img
export LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH
TMPFILE=./test.img
export LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH
export TZ
LC_ALL=C
export LC_ALL
export TZ
LC_ALL=C
export LC_ALL