sortix-mirror/ports/e2fsprogs/e2fsprogs.patch

1404 lines
38 KiB
Diff

diff -Paur --no-dereference -- e2fsprogs.upstream/MCONFIG.in e2fsprogs/MCONFIG.in
--- e2fsprogs.upstream/MCONFIG.in
+++ e2fsprogs/MCONFIG.in
@@ -138,7 +138,7 @@
LIBUUID = @LIBUUID@ @SOCKET_LIB@
LIBMAGIC = @MAGIC_LIB@
LIBFUSE = @FUSE_LIB@
-LIBSUPPORT = $(LIBINTL) $(LIB)/libsupport@STATIC_LIB_EXT@
+LIBSUPPORT = $(LIB)/libsupport@STATIC_LIB_EXT@ $(LIBINTL)
LIBBLKID = @LIBBLKID@ @PRIVATE_LIBS_CMT@ $(LIBUUID)
LIBINTL = @LIBINTL@
SYSLIBS = @LIBS@ @PTHREAD_LIBS@
@@ -154,7 +154,7 @@
STATIC_LIBE2P = $(LIB)/libe2p@STATIC_LIB_EXT@
STATIC_LIBEXT2FS = $(LIB)/libext2fs@STATIC_LIB_EXT@
STATIC_LIBUUID = @STATIC_LIBUUID@ @SOCKET_LIB@
-STATIC_LIBSUPPORT = $(LIBINTL) $(LIBSUPPORT)
+STATIC_LIBSUPPORT = $(LIBSUPPORT) $(LIBINTL)
STATIC_LIBBLKID = @STATIC_LIBBLKID@ $(STATIC_LIBUUID)
DEPSTATIC_LIBSS = $(LIB)/libss@STATIC_LIB_EXT@
DEPSTATIC_LIBCOM_ERR = $(LIB)/libcom_err@STATIC_LIB_EXT@
@@ -167,7 +167,7 @@
PROFILED_LIBE2P = $(LIB)/libe2p@PROFILED_LIB_EXT@
PROFILED_LIBEXT2FS = $(LIB)/libext2fs@PROFILED_LIB_EXT@
PROFILED_LIBUUID = @PROFILED_LIBUUID@ @SOCKET_LIB@
-PROFILED_LIBSUPPORT = $(LIBINTL) $(LIB)/libsupport@PROFILED_LIB_EXT@
+PROFILED_LIBSUPPORT = $(LIB)/libsupport@PROFILED_LIB_EXT@ $(LIBINTL)
PROFILED_LIBBLKID = @PROFILED_LIBBLKID@ $(PROFILED_LIBUUID)
DEPPROFILED_LIBSS = $(LIB)/libss@PROFILED_LIB_EXT@
DEPPROFILED_LIBCOM_ERR = $(LIB)/libcom_err@PROFILED_LIB_EXT@
diff -Paur --no-dereference -- e2fsprogs.upstream/Makefile.in e2fsprogs/Makefile.in
--- e2fsprogs.upstream/Makefile.in
+++ e2fsprogs/Makefile.in
@@ -135,6 +135,11 @@
$(RM) -rf autom4te.cache ext2ed/Makefile po/stamp-po \
asm_types.h config.log public_config.h parse-types.log
$(MAKE) distclean-local
+ $(RM) -f parse-types.log
+ $(RM) -f public_config.h
+ $(RM) -f util/install-symlink
+ $(RM) -f asm_types.h
+ $(RM) -f scrub/Makefile
realclean: realclean-recursive realclean-local
diff -Paur --no-dereference -- e2fsprogs.upstream/config/parse-types.sh e2fsprogs/config/parse-types.sh
--- e2fsprogs.upstream/config/parse-types.sh
+++ e2fsprogs/config/parse-types.sh
@@ -1,5 +1,9 @@
#!/bin/sh
+# PATCH: Disable insanity in favor of <stdint.h>.
+printf '' > asm_types.h
+exit 0
+
cat > sed.script << "EOF"
/^#/d
/^$/d
@@ -19,7 +23,7 @@
/bin/echo -n "checking for __uNN types... "
# can't check [ -f /usr/include/asm/types.h ] directly, since
# the include path might be different if cross-compiling
-if echo '#include <asm/types.h>' | $CPP - 2> parse-types.log | \
+if echo '#include <asm/types.h>' | ${BUILD_CC-${CC-gcc}} -E - 2> parse-types.log | \
sed -f sed.script | grep '^#' > asm_types.h; then
echo "using <asm/types.h>"
else
diff -Paur --no-dereference -- e2fsprogs.upstream/debugfs/debugfs.c e2fsprogs/debugfs/debugfs.c
--- e2fsprogs.upstream/debugfs/debugfs.c
+++ e2fsprogs/debugfs/debugfs.c
@@ -1816,7 +1816,11 @@
if (argc != nr)
goto usage;
+#ifdef __sortix__
+ st.st_rdev = 0;
+#else
st.st_rdev = makedev(major, minor);
+#endif
retval = do_mknod_internal(current_fs, cwd, argv[1],
st.st_mode, st.st_rdev);
if (retval)
diff -Paur --no-dereference -- e2fsprogs.upstream/debugfs/journal.c e2fsprogs/debugfs/journal.c
--- e2fsprogs.upstream/debugfs/journal.c
+++ e2fsprogs/debugfs/journal.c
@@ -14,7 +14,6 @@
#include "config.h"
#ifdef HAVE_SYS_MOUNT_H
-#include <sys/param.h>
#include <sys/mount.h>
#define MNT_FL (MS_MGC_VAL | MS_RDONLY)
#endif
diff -Paur --no-dereference -- e2fsprogs.upstream/e2fsck/journal.c e2fsprogs/e2fsck/journal.c
--- e2fsprogs.upstream/e2fsck/journal.c
+++ e2fsprogs/e2fsck/journal.c
@@ -14,7 +14,6 @@
#include "config.h"
#ifdef HAVE_SYS_MOUNT_H
-#include <sys/param.h>
#include <sys/mount.h>
#define MNT_FL (MS_MGC_VAL | MS_RDONLY)
#endif
@@ -634,11 +633,11 @@
val + sizeof(struct ext4_fc_dentry_info),
darg->dname_len);
darg->dname[darg->dname_len] = 0;
- jbd_debug(1, "%s: %s, ino %u, parent %u\n",
+ jbd_debug(1, "%s: %s, ino %ju, parent %ju\n",
le16_to_cpu(tl->fc_tag) == EXT4_FC_TAG_CREAT ? "create" :
(le16_to_cpu(tl->fc_tag) == EXT4_FC_TAG_LINK ? "link" :
(le16_to_cpu(tl->fc_tag) == EXT4_FC_TAG_UNLINK ? "unlink" :
- "error")), darg->dname, darg->ino, darg->parent_ino);
+ "error")), darg->dname, (uintmax_t)darg->ino, (uintmax_t)darg->parent_ino);
return 0;
}
diff -Paur --no-dereference -- e2fsprogs.upstream/e2fsck/logfile.c e2fsprogs/e2fsck/logfile.c
--- e2fsprogs.upstream/e2fsck/logfile.c
+++ e2fsprogs/e2fsck/logfile.c
@@ -22,6 +22,36 @@
extern e2fsck_t e2fsck_global_ctx; /* Try your very best not to use this! */
+#if defined(__sortix__)
+int daemon(int nochdir, int noclose)
+{
+ if (!nochdir && chdir("/"))
+ return -1;
+ if (!noclose) {
+ int fd, failed = 0;
+ if ((fd = open("/dev/null", O_RDWR)) < 0) return -1;
+ if (dup2(fd, 0) < 0 || dup2(fd, 1) < 0 || dup2(fd, 2) < 0)
+ failed++;
+ if (fd > 2) close(fd);
+ if (failed) return -1;
+ }
+
+ switch(fork()) {
+ case 0: break;
+ case -1: return -1;
+ default: _exit(0);
+ }
+
+ switch(fork()) {
+ case 0: break;
+ case -1: return -1;
+ default: _exit(0);
+ }
+
+ return 0;
+}
+#endif
+
struct string {
char *s;
int len;
diff -Paur --no-dereference -- e2fsprogs.upstream/e2fsck/quota.c e2fsprogs/e2fsck/quota.c
--- e2fsprogs.upstream/e2fsck/quota.c
+++ e2fsprogs/e2fsck/quota.c
@@ -5,7 +5,6 @@
#include "config.h"
#ifdef HAVE_SYS_MOUNT_H
-#include <sys/param.h>
#include <sys/mount.h>
#define MNT_FL (MS_MGC_VAL | MS_RDONLY)
#endif
diff -Paur --no-dereference -- e2fsprogs.upstream/e2fsck/scantest.c e2fsprogs/e2fsck/scantest.c
--- e2fsprogs.upstream/e2fsck/scantest.c
+++ e2fsprogs/e2fsck/scantest.c
@@ -54,7 +54,7 @@
{
struct rusage r;
- track->brk_start = sbrk(0);
+ track->brk_start = 0;
gettimeofday(&track->time_start, 0);
getrusage(RUSAGE_SELF, &r);
track->user_start = r.ru_utime;
@@ -77,7 +77,7 @@
getrusage(RUSAGE_SELF, &r);
printf(_("Memory used: %lu, elapsed time: %6.3f/%6.3f/%6.3f\n"),
- (unsigned long)((char *)sbrk(0) - (char *)track->brk_start),
+ (unsigned long)((char *)0 - (char *)track->brk_start),
timeval_subtract(&time_end, &track->time_start),
timeval_subtract(&r.ru_utime, &track->user_start),
timeval_subtract(&r.ru_stime, &track->system_start));
diff -Paur --no-dereference -- e2fsprogs.upstream/e2fsck/sigcatcher.c e2fsprogs/e2fsck/sigcatcher.c
--- e2fsprogs.upstream/e2fsck/sigcatcher.c
+++ e2fsprogs/e2fsck/sigcatcher.c
@@ -10,6 +10,7 @@
*/
#include "config.h"
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
@@ -339,7 +340,7 @@
fprintf(stderr, "Signal (%d) %s ", signum,
lookup_table_fallback(signum, sig_table));
if (siginfo->si_code == SI_USER)
- fprintf(stderr, "(sent from pid %u) ", siginfo->si_pid);
+ fprintf(stderr, "(sent from pid %ji) ", (intmax_t) siginfo->si_pid);
cp = lookup_table(siginfo->si_code, generic_code_table);
if (cp)
fprintf(stderr, "si_code=%s ", cp);
diff -Paur --no-dereference -- e2fsprogs.upstream/e2fsck/unix.c e2fsprogs/e2fsck/unix.c
--- e2fsprogs.upstream/e2fsck/unix.c
+++ e2fsprogs/e2fsck/unix.c
@@ -291,7 +291,7 @@
{
FILE *f;
DIR *d;
- char tmp[80], tmp2[80], fname[NAME_MAX+30];
+ char tmp[80], tmp2[80], fname[256+30];
unsigned int acflag;
struct dirent* de;
@@ -605,8 +605,6 @@
return 0;
}
-#define PATH_SET "PATH=/sbin"
-
/*
* Make sure 0,1,2 file descriptors are open, so that we don't open
* the filesystem using the same file descriptor as stdout or stderr.
@@ -1130,21 +1128,21 @@
if (cflag) {
char *oldpath = getenv("PATH");
char *newpath;
- int len = sizeof(PATH_SET) + 1;
+ size_t len = strlen("/sbin");
if (oldpath)
- len += strlen(oldpath);
+ len += 1 + strlen(oldpath);
- newpath = malloc(len);
+ newpath = malloc(len + 1);
if (!newpath)
fatal_error(ctx, "Couldn't malloc() newpath");
- strcpy(newpath, PATH_SET);
+ strcpy(newpath, "/sbin");
if (oldpath) {
strcat(newpath, ":");
strcat(newpath, oldpath);
}
- putenv(newpath);
+ setenv("PATH", newpath, 1);
}
#ifdef CONFIG_JBD_DEBUG
jbd_debug = getenv("E2FSCK_JBD_DEBUG");
diff -Paur --no-dereference -- e2fsprogs.upstream/e2fsck/util.c e2fsprogs/e2fsck/util.c
--- e2fsprogs.upstream/e2fsck/util.c
+++ e2fsprogs/e2fsck/util.c
@@ -375,7 +375,7 @@
#endif
io_stats io_start = 0;
- track->brk_start = sbrk(0);
+ track->brk_start = 0;
gettimeofday(&track->time_start, 0);
#ifdef HAVE_GETRUSAGE
#ifdef sun
@@ -451,7 +451,7 @@
} else
#endif
log_out(ctx, _("Memory used: %lluk, "),
- kbytes(((char *)sbrk(0)) - ((char *)track->brk_start)));
+ kbytes(((char *)0) - ((char *)track->brk_start)));
#ifdef HAVE_GETRUSAGE
getrusage(RUSAGE_SELF, &r);
diff -Paur --no-dereference -- e2fsprogs.upstream/lib/blkid/blkid_types.h.in e2fsprogs/lib/blkid/blkid_types.h.in
--- e2fsprogs.upstream/lib/blkid/blkid_types.h.in
+++ e2fsprogs/lib/blkid/blkid_types.h.in
@@ -7,161 +7,46 @@
!defined(_EXT2_TYPES_H))
#define _BLKID_TYPES_H
-@ASM_TYPES_HEADER@
+#include <stdint.h>
#ifndef HAVE___U8
#define HAVE___U8
-#ifdef __U8_TYPEDEF
-typedef __U8_TYPEDEF __u8;
-#else
-typedef unsigned char __u8;
-#endif
+typedef uint8_t __u8;
#endif /* HAVE___U8 */
#ifndef HAVE___S8
#define HAVE___S8
-#ifdef __S8_TYPEDEF
-typedef __S8_TYPEDEF __s8;
-#else
-typedef signed char __s8;
-#endif
+typedef int8_t __s8;
#endif /* HAVE___S8 */
#ifndef HAVE___U16
#define HAVE___U16
-#ifdef __U16_TYPEDEF
-typedef __U16_TYPEDEF __u16;
-#else
-#if (@SIZEOF_INT@ == 2)
-typedef unsigned int __u16;
-#else
-#if (@SIZEOF_SHORT@ == 2)
-typedef unsigned short __u16;
-#else
-#undef HAVE___U16
- ?==error: undefined 16 bit type
-#endif /* SIZEOF_SHORT == 2 */
-#endif /* SIZEOF_INT == 2 */
-#endif /* __U16_TYPEDEF */
+typedef uint16_t __u16;
#endif /* HAVE___U16 */
#ifndef HAVE___S16
#define HAVE___S16
-#ifdef __S16_TYPEDEF
-typedef __S16_TYPEDEF __s16;
-#else
-#if (@SIZEOF_INT@ == 2)
-typedef int __s16;
-#else
-#if (@SIZEOF_SHORT@ == 2)
-typedef short __s16;
-#else
-#undef HAVE___S16
- ?==error: undefined 16 bit type
-#endif /* SIZEOF_SHORT == 2 */
-#endif /* SIZEOF_INT == 2 */
-#endif /* __S16_TYPEDEF */
+typedef int16_t __s16;
#endif /* HAVE___S16 */
#ifndef HAVE___U32
#define HAVE___U32
-#ifdef __U32_TYPEDEF
-typedef __U32_TYPEDEF __u32;
-#else
-#if (@SIZEOF_INT@ == 4)
-typedef unsigned int __u32;
-#else
-#if (@SIZEOF_LONG@ == 4)
-typedef unsigned long __u32;
-#else
-#if (@SIZEOF_SHORT@ == 4)
-typedef unsigned short __u32;
-#else
-#undef HAVE___U32
- ?== error: undefined 32 bit type
-#endif /* SIZEOF_SHORT == 4 */
-#endif /* SIZEOF_LONG == 4 */
-#endif /* SIZEOF_INT == 4 */
-#endif /* __U32_TYPEDEF */
+typedef uint32_t __u32;
#endif /* HAVE___U32 */
#ifndef HAVE___S32
#define HAVE___S32
-#ifdef __S32_TYPEDEF
-typedef __S32_TYPEDEF __s32;
-#else
-#if (@SIZEOF_INT@ == 4)
-typedef int __s32;
-#else
-#if (@SIZEOF_LONG@ == 4)
-typedef long __s32;
-#else
-#if (@SIZEOF_SHORT@ == 4)
-typedef short __s32;
-#else
-#undef HAVE___S32
- ?== error: undefined 32 bit type
-#endif /* SIZEOF_SHORT == 4 */
-#endif /* SIZEOF_LONG == 4 */
-#endif /* SIZEOF_INT == 4 */
-#endif /* __S32_TYPEDEF */
+typedef int32_t __s32;
#endif /* HAVE___S32 */
#ifndef HAVE___U64
#define HAVE___U64
-#ifdef __U64_TYPEDEF
-typedef __U64_TYPEDEF __u64;
-#else
-#if (@SIZEOF_INT@ == 8)
-typedef unsigned int __u64;
-#else
-#if (@SIZEOF_LONG_LONG@ == 8)
-typedef unsigned long long __u64;
-#else
-#if (@SIZEOF_LONG@ == 8)
-typedef unsigned long __u64;
-#else
-#undef HAVE___U64
- ?== error: undefined 64 bit type
-#endif /* SIZEOF_LONG == 8 */
-#endif /* SIZEOF_LONG_LONG == 8 */
-#endif /* SIZEOF_INT == 8 */
-#endif /* __U64_TYPEDEF */
+typedef unsigned long long __u64; /* Uses %llu instead of PRIu64... */
#endif /* HAVE___U64 */
#ifndef HAVE___S64
#define HAVE___S64
-#ifdef __S64_TYPEDEF
-typedef __S64_TYPEDEF __s64;
-#else
-#if (@SIZEOF_INT@ == 8)
-typedef int __s64;
-#else
-#if (@SIZEOF_LONG_LONG@ == 8)
-#if defined(__GNUC__)
-typedef __signed__ long long __s64;
-#else
-typedef signed long long __s64;
-#endif /* __GNUC__ */
-#else
-#if (@SIZEOF_LONG@ == 8)
-typedef long __s64;
-#else
-#undef HAVE___S64
- ?== error: undefined 64 bit type
-#endif /* SIZEOF_LONG == 8 */
-#endif /* SIZEOF_LONG_LONG == 8 */
-#endif /* SIZEOF_INT == 8 */
-#endif /* __S64_TYPEDEF */
+typedef long long __s64; /* Uses %lld instead of PRId64... */
#endif /* HAVE___S64 */
-#undef __S8_TYPEDEF
-#undef __U8_TYPEDEF
-#undef __S16_TYPEDEF
-#undef __U16_TYPEDEF
-#undef __S32_TYPEDEF
-#undef __U32_TYPEDEF
-#undef __S64_TYPEDEF
-#undef __U64_TYPEDEF
-
#endif /* _*_TYPES_H */
diff -Paur --no-dereference -- e2fsprogs.upstream/lib/blkid/devname.c e2fsprogs/lib/blkid/devname.c
--- e2fsprogs.upstream/lib/blkid/devname.c
+++ e2fsprogs/lib/blkid/devname.c
@@ -43,6 +43,10 @@
#include "blkidP.h"
+#if defined(__sortix__)
+#define makedev(a, b) 0
+#endif
+
/*
* Find a dev struct in the cache by device name, if available.
*
diff -Paur --no-dereference -- e2fsprogs.upstream/lib/ext2fs/bitmaps.c e2fsprogs/lib/ext2fs/bitmaps.c
--- e2fsprogs.upstream/lib/ext2fs/bitmaps.c
+++ e2fsprogs/lib/ext2fs/bitmaps.c
@@ -21,6 +21,7 @@
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
+#include <sys/time.h>
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
diff -Paur --no-dereference -- e2fsprogs.upstream/lib/ext2fs/blkmap64_ba.c e2fsprogs/lib/ext2fs/blkmap64_ba.c
--- e2fsprogs.upstream/lib/ext2fs/blkmap64_ba.c
+++ e2fsprogs/lib/ext2fs/blkmap64_ba.c
@@ -20,6 +20,7 @@
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
+#include <sys/time.h>
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
diff -Paur --no-dereference -- e2fsprogs.upstream/lib/ext2fs/blkmap64_rb.c e2fsprogs/lib/ext2fs/blkmap64_rb.c
--- e2fsprogs.upstream/lib/ext2fs/blkmap64_rb.c
+++ e2fsprogs/lib/ext2fs/blkmap64_rb.c
@@ -20,6 +20,7 @@
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
+#include <sys/time.h>
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
diff -Paur --no-dereference -- e2fsprogs.upstream/lib/ext2fs/ext2_types.h.in e2fsprogs/lib/ext2fs/ext2_types.h.in
--- e2fsprogs.upstream/lib/ext2fs/ext2_types.h.in
+++ e2fsprogs/lib/ext2fs/ext2_types.h.in
@@ -7,163 +7,48 @@
!defined(_EXT2_TYPES_H))
#define _EXT2_TYPES_H
-@ASM_TYPES_HEADER@
+#include <stdint.h>
#ifndef HAVE___U8
#define HAVE___U8
-#ifdef __U8_TYPEDEF
-typedef __U8_TYPEDEF __u8;
-#else
-typedef unsigned char __u8;
-#endif
+typedef uint8_t __u8;
#endif /* HAVE___U8 */
#ifndef HAVE___S8
#define HAVE___S8
-#ifdef __S8_TYPEDEF
-typedef __S8_TYPEDEF __s8;
-#else
-typedef signed char __s8;
-#endif
+typedef int8_t __s8;
#endif /* HAVE___S8 */
#ifndef HAVE___U16
#define HAVE___U16
-#ifdef __U16_TYPEDEF
-typedef __U16_TYPEDEF __u16;
-#else
-#if (@SIZEOF_INT@ == 2)
-typedef unsigned int __u16;
-#else
-#if (@SIZEOF_SHORT@ == 2)
-typedef unsigned short __u16;
-#else
-#undef HAVE___U16
- ?==error: undefined 16 bit type
-#endif /* SIZEOF_SHORT == 2 */
-#endif /* SIZEOF_INT == 2 */
-#endif /* __U16_TYPEDEF */
+typedef uint16_t __u16;
#endif /* HAVE___U16 */
#ifndef HAVE___S16
#define HAVE___S16
-#ifdef __S16_TYPEDEF
-typedef __S16_TYPEDEF __s16;
-#else
-#if (@SIZEOF_INT@ == 2)
-typedef int __s16;
-#else
-#if (@SIZEOF_SHORT@ == 2)
-typedef short __s16;
-#else
-#undef HAVE___S16
- ?==error: undefined 16 bit type
-#endif /* SIZEOF_SHORT == 2 */
-#endif /* SIZEOF_INT == 2 */
-#endif /* __S16_TYPEDEF */
+typedef int16_t __s16;
#endif /* HAVE___S16 */
#ifndef HAVE___U32
#define HAVE___U32
-#ifdef __U32_TYPEDEF
-typedef __U32_TYPEDEF __u32;
-#else
-#if (@SIZEOF_INT@ == 4)
-typedef unsigned int __u32;
-#else
-#if (@SIZEOF_LONG@ == 4)
-typedef unsigned long __u32;
-#else
-#if (@SIZEOF_SHORT@ == 4)
-typedef unsigned short __u32;
-#else
-#undef HAVE___U32
- ?== error: undefined 32 bit type
-#endif /* SIZEOF_SHORT == 4 */
-#endif /* SIZEOF_LONG == 4 */
-#endif /* SIZEOF_INT == 4 */
-#endif /* __U32_TYPEDEF */
+typedef uint32_t __u32;
#endif /* HAVE___U32 */
#ifndef HAVE___S32
#define HAVE___S32
-#ifdef __S32_TYPEDEF
-typedef __S32_TYPEDEF __s32;
-#else
-#if (@SIZEOF_INT@ == 4)
-typedef int __s32;
-#else
-#if (@SIZEOF_LONG@ == 4)
-typedef long __s32;
-#else
-#if (@SIZEOF_SHORT@ == 4)
-typedef short __s32;
-#else
-#undef HAVE___S32
- ?== error: undefined 32 bit type
-#endif /* SIZEOF_SHORT == 4 */
-#endif /* SIZEOF_LONG == 4 */
-#endif /* SIZEOF_INT == 4 */
-#endif /* __S32_TYPEDEF */
+typedef int32_t __s32;
#endif /* HAVE___S32 */
#ifndef HAVE___U64
#define HAVE___U64
-#ifdef __U64_TYPEDEF
-typedef __U64_TYPEDEF __u64;
-#else
-#if (@SIZEOF_INT@ == 8)
-typedef unsigned int __u64;
-#else
-#if (@SIZEOF_LONG_LONG@ == 8)
-typedef unsigned long long __u64;
-#else
-#if (@SIZEOF_LONG@ == 8)
-typedef unsigned long __u64;
-#else
-#undef HAVE___U64
- ?== error: undefined 64 bit type
-#endif /* SIZEOF_LONG_LONG == 8 */
-#endif /* SIZEOF_LONG == 8 */
-#endif /* SIZEOF_INT == 8 */
-#endif /* __U64_TYPEDEF */
+typedef unsigned long long __u64; /* Uses %llu instead of PRIu64... */
#endif /* HAVE___U64 */
#ifndef HAVE___S64
#define HAVE___S64
-#ifdef __S64_TYPEDEF
-typedef __S64_TYPEDEF __s64;
-#else
-#if (@SIZEOF_INT@ == 8)
-typedef int __s64;
-#else
-#if (@SIZEOF_LONG_LONG@ == 8)
-#if defined(__GNUC__)
-typedef __signed__ long long __s64;
-#else
-typedef signed long long __s64;
-#endif /* __GNUC__ */
-#else
-#if (@SIZEOF_LONG@ == 8)
-typedef long __s64;
-#else
-#undef HAVE___S64
- ?== error: undefined 64 bit type
-#endif /* SIZEOF_LONG_LONG == 8 */
-#endif /* SIZEOF_LONG == 8 */
-#endif /* SIZEOF_INT == 8 */
-#endif /* __S64_TYPEDEF */
+typedef long long __s64; /* Uses %lld instead of PRId64... */
#endif /* HAVE___S64 */
-#undef __S8_TYPEDEF
-#undef __U8_TYPEDEF
-#undef __S16_TYPEDEF
-#undef __U16_TYPEDEF
-#undef __S32_TYPEDEF
-#undef __U32_TYPEDEF
-#undef __S64_TYPEDEF
-#undef __U64_TYPEDEF
-
#endif /* _*_TYPES_H */
#include <stdint.h>
diff -Paur --no-dereference -- e2fsprogs.upstream/lib/ext2fs/flushb.c e2fsprogs/lib/ext2fs/flushb.c
--- e2fsprogs.upstream/lib/ext2fs/flushb.c
+++ e2fsprogs/lib/ext2fs/flushb.c
@@ -22,7 +22,6 @@
#include <sys/ioctl.h>
#endif
#if HAVE_SYS_MOUNT_H
-#include <sys/param.h>
#include <sys/mount.h> /* This may define BLKFLSBUF */
#endif
diff -Paur --no-dereference -- e2fsprogs.upstream/lib/ext2fs/getsize.c e2fsprogs/lib/ext2fs/getsize.c
--- e2fsprogs.upstream/lib/ext2fs/getsize.c
+++ e2fsprogs/lib/ext2fs/getsize.c
@@ -252,13 +252,20 @@
{
ext2fs_struct_stat st;
- if (ext2fs_fstat(fd, &st) == 0)
+ if (ext2fs_fstat(fd, &st) == 0) {
+#if !defined(__sortix__)
if (S_ISREG(st.st_mode)) {
+#endif
*retblocks = st.st_size / blocksize;
goto out;
+#if !defined(__sortix__)
}
+#endif
+ }
}
+ /* This fallback seems to get one block too few on Sortix. fstat reports
+ correctly on block devices on Sortix. That's why we always use fstat. */
/*
* OK, we couldn't figure it out by using a specialized ioctl,
* which is generally the best way. So do binary search to
diff -Paur --no-dereference -- e2fsprogs.upstream/lib/ext2fs/mmp.c e2fsprogs/lib/ext2fs/mmp.c
--- e2fsprogs.upstream/lib/ext2fs/mmp.c
+++ e2fsprogs/lib/ext2fs/mmp.c
@@ -170,24 +170,7 @@
unsigned ext2fs_mmp_new_seq(void)
{
#ifdef CONFIG_MMP
- unsigned new_seq;
- struct timeval tv;
- unsigned long pid = getpid();
-
- gettimeofday(&tv, 0);
- pid = (pid >> 16) | ((pid & 0xFFFF) << 16);
- srand(pid ^ getuid() ^ tv.tv_sec ^ tv.tv_usec);
-
- gettimeofday(&tv, 0);
- /* Crank the random number generator a few times */
- for (new_seq = (tv.tv_sec ^ tv.tv_usec) & 0x1F; new_seq > 0; new_seq--)
- rand();
-
- do {
- new_seq = rand();
- } while (new_seq > EXT4_MMP_SEQ_MAX);
-
- return new_seq;
+ return arc4random_uniform(EXT4_MMP_SEQ_MAX);
#else
return EXT2_ET_OP_NOT_SUPPORTED;
#endif
diff -Paur --no-dereference -- e2fsprogs.upstream/lib/ext2fs/tdb.c e2fsprogs/lib/ext2fs/tdb.c
--- e2fsprogs.upstream/lib/ext2fs/tdb.c
+++ e2fsprogs/lib/ext2fs/tdb.c
@@ -58,13 +58,33 @@
#include <utime.h>
#endif
#include <sys/stat.h>
+#if __has_include(<sys/file.h>)
#include <sys/file.h>
+#endif
#include <fcntl.h>
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
+#ifndef F_UNLCK
+#define F_UNLCK 0
+#define F_RDLCK 1
+#define F_WRLCK 2
+#define F_GETLK 1000
+#define F_SETLK 1001
+#define F_SETLKW 1002
+struct flock
+{
+ short l_type;
+ short l_whence;
+ off_t l_start;
+ off_t l_len;
+ pid_t l_pid;
+};
+#define fcntl(...) 0
+#endif
+
#ifdef __GNUC__
#define EXT2FS_ATTR(x) __attribute__(x)
#else
diff -Paur --no-dereference -- e2fsprogs.upstream/lib/ss/help.c e2fsprogs/lib/ss/help.c
--- e2fsprogs.upstream/lib/ss/help.c
+++ e2fsprogs/lib/ss/help.c
@@ -22,9 +22,7 @@
#include <errno.h>
#endif
#include <fcntl.h>
-#include <sys/param.h>
#include <sys/types.h>
-#include <sys/file.h>
#ifdef NEED_SYS_FCNTL_H
/* just for O_* */
#include <sys/fcntl.h>
diff -Paur --no-dereference -- e2fsprogs.upstream/lib/ss/listen.c e2fsprogs/lib/ss/listen.c
--- e2fsprogs.upstream/lib/ss/listen.c
+++ e2fsprogs/lib/ss/listen.c
@@ -21,7 +21,6 @@
#include <stdio.h>
#include <setjmp.h>
#include <signal.h>
-#include <sys/param.h>
typedef void sigret_t;
diff -Paur --no-dereference -- e2fsprogs.upstream/lib/ss/pager.c e2fsprogs/lib/ss/pager.c
--- e2fsprogs.upstream/lib/ss/pager.c
+++ e2fsprogs/lib/ss/pager.c
@@ -25,7 +25,6 @@
#include "ss_internal.h"
#include <stdio.h>
#include <sys/types.h>
-#include <sys/file.h>
#include <signal.h>
#ifdef HAVE_SYS_PRCTL_H
#include <sys/prctl.h>
diff -Paur --no-dereference -- e2fsprogs.upstream/lib/support/quotaio.c e2fsprogs/lib/support/quotaio.c
--- e2fsprogs.upstream/lib/support/quotaio.c
+++ e2fsprogs/lib/support/quotaio.c
@@ -14,7 +14,6 @@
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/file.h>
#include <assert.h>
#include "common.h"
diff -Paur --no-dereference -- e2fsprogs.upstream/lib/uuid/gen_uuid.c e2fsprogs/lib/uuid/gen_uuid.c
--- e2fsprogs.upstream/lib/uuid/gen_uuid.c
+++ e2fsprogs/lib/uuid/gen_uuid.c
@@ -96,9 +96,22 @@
#include "uuidP.h"
#include "uuidd.h"
-#ifdef HAVE_SRANDOM
-#define srand(x) srandom(x)
-#define rand() random()
+#if defined(__sortix__)
+#define F_UNLCK 0
+#define F_RDLCK 1
+#define F_WRLCK 2
+#define F_GETLK 1000
+#define F_SETLK 1001
+#define F_SETLKW 1002
+struct flock
+{
+ short l_type;
+ short l_whence;
+ off_t l_start;
+ off_t l_len;
+ pid_t l_pid;
+};
+#define fcntl(...) 0
#endif
#ifdef TLS
@@ -112,94 +125,13 @@
THREAD_LOCAL unsigned short jrand_seed[3];
#endif
-static int get_random_fd(void)
-{
- struct timeval tv;
- static int fd = -2;
- int i;
-
- if (fd == -2) {
- gettimeofday(&tv, 0);
-#ifndef _WIN32
- fd = open("/dev/urandom", O_RDONLY);
- if (fd == -1)
- fd = open("/dev/random", O_RDONLY | O_NONBLOCK);
- if (fd >= 0) {
- i = fcntl(fd, F_GETFD);
- if (i >= 0)
- fcntl(fd, F_SETFD, i | FD_CLOEXEC);
- }
-#endif
- srand(((unsigned)getpid() << 16) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec);
-#ifdef DO_JRAND_MIX
- jrand_seed[0] = getpid() ^ (tv.tv_sec & 0xFFFF);
- jrand_seed[1] = getppid() ^ (tv.tv_usec & 0xFFFF);
- jrand_seed[2] = (tv.tv_sec ^ tv.tv_usec) >> 16;
-#endif
- }
- /* Crank the random number generator a few times */
- gettimeofday(&tv, 0);
- for (i = (tv.tv_sec ^ tv.tv_usec) & 0x1F; i > 0; i--)
- rand();
- return fd;
-}
-
-
/*
* Generate a series of random bytes. Use /dev/urandom if possible,
* and if not, use srandom/random.
*/
static void get_random_bytes(void *buf, int nbytes)
{
- int i, n = nbytes, fd;
- int lose_counter = 0;
- unsigned char *cp = buf;
-
-#ifdef HAVE_GETRANDOM
- i = getrandom(buf, nbytes, 0);
- if (i == nbytes)
- return;
-#endif
-#ifdef HAVE_GETENTROPY
- if (getentropy(buf, nbytes) == 0)
- return;
-#endif
-
- fd = get_random_fd();
- if (fd >= 0) {
- while (n > 0) {
- i = read(fd, cp, n);
- if (i <= 0) {
- if (lose_counter++ > 16)
- break;
- continue;
- }
- n -= i;
- cp += i;
- lose_counter = 0;
- }
- }
-
- /*
- * We do this all the time, but this is the only source of
- * randomness if /dev/random/urandom is out to lunch.
- */
- for (cp = buf, i = 0; i < nbytes; i++)
- *cp++ ^= (rand() >> 7) & 0xFF;
-#ifdef DO_JRAND_MIX
- {
- unsigned short tmp_seed[3];
-
- memcpy(tmp_seed, jrand_seed, sizeof(tmp_seed));
- jrand_seed[2] = jrand_seed[2] ^ syscall(__NR_gettid);
- for (cp = buf, i = 0; i < nbytes; i++)
- *cp++ ^= (jrand48(tmp_seed) >> 7) & 0xFF;
- memcpy(jrand_seed, tmp_seed,
- sizeof(jrand_seed) - sizeof(unsigned short));
- }
-#endif
-
- return;
+ arc4random_buf(buf, nbytes);
}
/*
@@ -212,7 +144,9 @@
*/
static int get_node_id(unsigned char *node_id)
{
-#ifdef HAVE_NET_IF_H
+#if defined(HAVE_NET_IF_H) && (defined(SIOCGIFHWADDR) || \
+ defined(SIOCGENADDR) || \
+ defined(HAVE_NET_IF_DL_H))
int sd;
struct ifreq ifr, *ifrp;
struct ifconf ifc;
@@ -669,14 +603,10 @@
/*
* This is the generic front-end to uuid_generate_random and
- * uuid_generate_time. It uses uuid_generate_random only if
- * /dev/urandom is available, since otherwise we won't have
- * high-quality randomness.
+ * uuid_generate_time. It uses uuid_generate_random only,
+ * because good randomness is always available.
*/
void uuid_generate(uuid_t out)
{
- if (get_random_fd() >= 0)
- uuid_generate_random(out);
- else
- uuid_generate_time(out);
+ uuid_generate_random(out);
}
diff -Paur --no-dereference -- e2fsprogs.upstream/lib/uuid/tst_uuid.c e2fsprogs/lib/uuid/tst_uuid.c
--- e2fsprogs.upstream/lib/uuid/tst_uuid.c
+++ e2fsprogs/lib/uuid/tst_uuid.c
@@ -137,9 +137,9 @@
tv.tv_sec = 0;
tv.tv_usec = 0;
time_reg = uuid_time(buf, &tv);
- printf("UUID generated at %lu reports %lu (%ld.%ld)\n",
- (unsigned long)time_gen, (unsigned long)time_reg,
- (long)tv.tv_sec, (long)tv.tv_usec);
+ printf("UUID generated at %llu reports %llu (%lld.%ld)\n",
+ (unsigned long long)time_gen, (unsigned long long)time_reg,
+ (long long)tv.tv_sec, (long)tv.tv_usec);
/* allow 1s margin in case of rollover between sampling
* the current time and when the UUID is generated. */
if (time_reg > time_gen + 1) {
diff -Paur --no-dereference -- e2fsprogs.upstream/lib/uuid/uuid_time.c e2fsprogs/lib/uuid/uuid_time.c
--- e2fsprogs.upstream/lib/uuid/uuid_time.c
+++ e2fsprogs/lib/uuid/uuid_time.c
@@ -159,7 +159,7 @@
printf("Warning: not a time-based UUID, so UUID time "
"decoding will likely not work!\n");
}
- printf("UUID time is: (%ld, %ld): %s\n", (long)tv.tv_sec, (long)tv.tv_usec,
+ printf("UUID time is: (%lld, %ld): %s\n", (long long)tv.tv_sec, (long)tv.tv_usec,
ctime(&time_reg));
return 0;
diff -Paur --no-dereference -- e2fsprogs.upstream/misc/Makefile.in e2fsprogs/misc/Makefile.in
--- e2fsprogs.upstream/misc/Makefile.in
+++ e2fsprogs/misc/Makefile.in
@@ -551,12 +551,13 @@
$(Q) $(SUBSTITUTE_UPTIME) $(srcdir)/filefrag.8.in filefrag.8
installdirs:
- $(E) " MKDIR_P $(sbindir) $(root_sbindir) $(bindir) $(man1dir) $(man8dir) $(libdir) $(root_sysconfdir)"
+ $(E) " MKDIR_P $(sbindir) $(root_sbindir) $(bindir) $(man1dir) $(man8dir) $(libdir) $(root_sysconfdir)" $(root_sysconfdir)/default"
$(Q) $(MKDIR_P) $(DESTDIR)$(sbindir) \
$(DESTDIR)$(root_sbindir) $(DESTDIR)$(bindir) \
$(DESTDIR)$(man1dir) $(DESTDIR)$(man8dir) \
$(DESTDIR)$(man1dir) $(DESTDIR)$(man5dir) \
- $(DESTDIR)$(libdir) $(DESTDIR)/$(root_sysconfdir)
+ $(DESTDIR)$(libdir) $(DESTDIR)/$(root_sysconfdir) \
+ $(DESTDIR)$(libdir) $(DESTDIR)/$(root_sysconfdir)/default
install: all $(SMANPAGES) $(UMANPAGES) installdirs
$(Q) for i in $(SPROGS); do \
@@ -622,34 +623,9 @@
(cd $(DESTDIR)$(man5dir); \
$(LN) $(LINK_INSTALL_FLAGS) ext4.5 $$i.5); \
done
- $(Q) if test -f $(DESTDIR)$(root_sysconfdir)/mke2fs.conf; then \
- if cmp -s $(DESTDIR)$(root_sysconfdir)/mke2fs.conf \
- mke2fs.conf; then \
- true; \
- else \
- if grep -q ext4dev $(DESTDIR)$(root_sysconfdir)/mke2fs.conf ; then \
- $(ES) " INSTALL_DATA $(root_sysconfdir)/mke2fs.conf.e2fsprogs-new"; \
- $(INSTALL_DATA) mke2fs.conf \
- $(DESTDIR)$(root_sysconfdir)/mke2fs.conf.e2fsprogs-new; \
- echo "Warning: installing mke2fs.conf in $(DESTDIR)$(root_sysconfdir)/mke2fs.conf.e2fsprogs-new"; \
- echo "Check to see if you need to update your $(root_sysconfdir)/mke2fs.conf"; \
- else \
- $(ES) " INSTALL_DATA $(root_sysconfdir)/mke2fs.conf"; \
- mv $(DESTDIR)$(root_sysconfdir)/mke2fs.conf \
- $(DESTDIR)$(root_sysconfdir)/mke2fs.conf.e2fsprogs-old; \
- $(INSTALL_DATA) mke2fs.conf \
- $(DESTDIR)$(root_sysconfdir)/mke2fs.conf; \
- echo "Your mke2fs.conf is too old. Backing up old version in"; \
- echo "$(DESTDIR)$(root_sysconfdir)/mke2fs.conf.e2fsprogs-old. Please check to see"; \
- echo "if you have any local customizations that you wish to preserve."; \
- fi; \
- echo " "; \
- fi; \
- else \
- $(ES) " INSTALL_DATA $(root_sysconfdir)/mke2fs.conf"; \
+ $(Q) $(ES) " INSTALL_DATA $(root_sysconfdir)/default/mke2fs.conf"; \
$(INSTALL_DATA) mke2fs.conf \
- $(DESTDIR)$(root_sysconfdir)/mke2fs.conf; \
- fi
+ $(DESTDIR)$(root_sysconfdir)/default/mke2fs.conf; \
install-strip: install
$(Q) for i in $(SPROGS); do \
diff -Paur --no-dereference -- e2fsprogs.upstream/misc/badblocks.c e2fsprogs/misc/badblocks.c
--- e2fsprogs.upstream/misc/badblocks.c
+++ e2fsprogs/misc/badblocks.c
@@ -331,7 +331,7 @@
if (pattern == (unsigned int) ~0) {
for (ptr = buffer; ptr < buffer + n; ptr++) {
- (*ptr) = random() % (1 << (8 * sizeof(char)));
+ (*ptr) = arc4random_uniform(1 << (8 * sizeof(char)));
}
if (s_flag | v_flag)
fputs(_("Testing with random pattern: "), stderr);
@@ -1079,7 +1079,6 @@
textdomain(NLS_CAT_NAME);
set_com_err_gettext(gettext);
#endif
- srandom((unsigned int)time(NULL)); /* simple randomness is enough */
test_func = test_ro;
/* Determine the system page size if possible */
diff -Paur --no-dereference -- e2fsprogs.upstream/misc/chattr.c e2fsprogs/misc/chattr.c
--- e2fsprogs.upstream/misc/chattr.c
+++ e2fsprogs/misc/chattr.c
@@ -31,7 +31,6 @@
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
-#include <sys/param.h>
#include <sys/stat.h>
#include "ext2fs/ext2_fs.h"
diff -Paur --no-dereference -- e2fsprogs.upstream/misc/create_inode.c e2fsprogs/misc/create_inode.c
--- e2fsprogs.upstream/misc/create_inode.c
+++ e2fsprogs/misc/create_inode.c
@@ -312,6 +312,7 @@
inode.i_atime = inode.i_ctime = inode.i_mtime =
fs->now ? fs->now : time(0);
+#ifndef __sortix__
if (filetype != S_IFIFO) {
devmajor = major(st_rdev);
devminor = minor(st_rdev);
@@ -325,6 +326,7 @@
((devminor & ~0xff) << 12);
}
}
+#endif
inode.i_links_count = 1;
retval = ext2fs_write_new_inode(fs, ino, &inode);
diff -Paur --no-dereference -- e2fsprogs.upstream/misc/e2fuzz.c e2fsprogs/misc/e2fuzz.c
--- e2fsprogs.upstream/misc/e2fuzz.c
+++ e2fsprogs/misc/e2fuzz.c
@@ -171,7 +171,7 @@
uint8_t *px = (uint8_t *)&x;
for (i = 0; i < sizeof(x); i++)
- px[i] = random();
+ px[i] = arc4random() & 0xff;
return min + (uint64_t)((double)(max - min) *
(x / ((double) UINT64_MAX + 1.0)));
@@ -259,7 +259,6 @@
perror(fsname);
goto fail;
}
- srandom(getseed());
hsize = fs->blocksize * ext2fs_blocks_count(fs->super);
if (user_corrupt_bytes > 0)
count = user_corrupt_bytes;
diff -Paur --no-dereference -- e2fsprogs.upstream/misc/lsattr.c e2fsprogs/misc/lsattr.c
--- e2fsprogs.upstream/misc/lsattr.c
+++ e2fsprogs/misc/lsattr.c
@@ -36,7 +36,6 @@
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/param.h>
#include <sys/stat.h>
#include "ext2fs/ext2_fs.h"
diff -Paur --no-dereference -- e2fsprogs.upstream/misc/mke2fs.c e2fsprogs/misc/mke2fs.c
--- e2fsprogs.upstream/misc/mke2fs.c
+++ e2fsprogs/misc/mke2fs.c
@@ -19,6 +19,7 @@
#define _XOPEN_SOURCE 600
#include "config.h"
+#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
@@ -48,6 +49,9 @@
#endif
#include <libgen.h>
#include <limits.h>
+#if defined(__sortix__)
+#define sync() 0
+#endif
#include <blkid/blkid.h>
#include "ext2fs/ext2_fs.h"
@@ -711,7 +715,7 @@
100.0 * ext2fs_r_blocks_count(s) / ext2fs_blocks_count(s));
printf(_("First data block=%u\n"), s->s_first_data_block);
if (root_uid != 0 || root_gid != 0)
- printf(_("Root directory owner=%u:%u\n"), root_uid, root_gid);
+ printf(_("Root directory owner=%ju:%ju\n"), (uintmax_t) root_uid, (uintmax_t) root_gid);
if (s->s_reserved_gdt_blocks)
printf(_("Maximum filesystem blocks=%lu\n"),
(s->s_reserved_gdt_blocks + fs->desc_blocks) *
@@ -794,8 +798,6 @@
return 1;
}
-#define PATH_SET "PATH=/sbin"
-
static void parse_extended_opts(struct ext2_super_block *param,
const char *opts)
{
@@ -1220,6 +1222,8 @@
static const char *config_fn[] = { ROOT_SYSCONFDIR "/mke2fs.conf", 0 };
+static const char *default_config_fn[] = { ROOT_SYSCONFDIR "/default/mke2fs.conf", 0 };
+
static void edit_feature(const char *str, __u32 *compat_array)
{
if (!str)
@@ -1603,27 +1607,27 @@
int fs_features_size = 0;
int use_bsize;
char *newpath;
- int pathlen = sizeof(PATH_SET) + 1;
+ size_t pathlen = strlen("/sbin");
#ifdef HAVE_BLKID_PROBE_GET_TOPOLOGY
struct device_param dev_param;
#endif
if (oldpath)
- pathlen += strlen(oldpath);
- newpath = malloc(pathlen);
+ pathlen += 1 + strlen(oldpath);
+ newpath = malloc(pathlen + 1);
if (!newpath) {
fprintf(stderr, "%s",
_("Couldn't allocate memory for new PATH.\n"));
exit(1);
}
- strcpy(newpath, PATH_SET);
+ strcpy(newpath, "/sbin");
/* Update our PATH to include /sbin */
if (oldpath) {
strcat (newpath, ":");
strcat (newpath, oldpath);
}
- putenv (newpath);
+ setenv("PATH", newpath, 1);
/* Determine the system page size if possible */
#ifdef HAVE_SYSCONF
@@ -1644,6 +1648,8 @@
config_fn[0] = tmp;
profile_set_syntax_err_cb(syntax_err_report);
retval = profile_init(config_fn, &profile);
+ if (retval == ENOENT)
+ retval = profile_init(default_config_fn, &profile);
if (retval == ENOENT) {
retval = profile_init(default_files, &profile);
if (retval)
diff -Paur --no-dereference -- e2fsprogs.upstream/misc/mke2fs.conf.in e2fsprogs/misc/mke2fs.conf.in
--- e2fsprogs.upstream/misc/mke2fs.conf.in
+++ e2fsprogs/misc/mke2fs.conf.in
@@ -1,5 +1,6 @@
[defaults]
- base_features = sparse_super,large_file,filetype,resize_inode,dir_index,ext_attr
+ #base_features = sparse_super,large_file,filetype,resize_inode,dir_index,ext_attr
+ base_features = large_file,filetype
default_mntopts = acl,user_xattr
enable_periodic_fsck = 0
blocksize = 4096
diff -Paur --no-dereference -- e2fsprogs.upstream/misc/mklost+found.c e2fsprogs/misc/mklost+found.c
--- e2fsprogs.upstream/misc/mklost+found.c
+++ e2fsprogs/misc/mklost+found.c
@@ -20,7 +20,6 @@
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
-#include <sys/param.h>
#include <sys/stat.h>
#include "ext2fs/ext2_fs.h"
diff -Paur --no-dereference -- e2fsprogs.upstream/misc/tune2fs.c e2fsprogs/misc/tune2fs.c
--- e2fsprogs.upstream/misc/tune2fs.c
+++ e2fsprogs/misc/tune2fs.c
@@ -97,6 +97,10 @@
#define EXT4_IOC_SETFSUUID _IOW('f', 44, struct fsuuid)
#endif
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
extern int ask_yn(const char *string, int def);
const char *program_name = "tune2fs";
@@ -3363,7 +3367,7 @@
if (c_flag) {
if (max_mount_count == 65536)
max_mount_count = EXT2_DFL_MAX_MNT_COUNT +
- (random() % EXT2_DFL_MAX_MNT_COUNT);
+ (arc4random_uniform(EXT2_DFL_MAX_MNT_COUNT));
sb->s_max_mnt_count = max_mount_count;
ext2fs_mark_super_dirty(fs);
printf(_("Setting maximal mount count to %d\n"),
diff -Paur --no-dereference -- e2fsprogs.upstream/misc/uuidd.c e2fsprogs/misc/uuidd.c
--- e2fsprogs.upstream/misc/uuidd.c
+++ e2fsprogs/misc/uuidd.c
@@ -12,6 +12,7 @@
#define _GNU_SOURCE /* for setres[ug]id() */
#include "config.h"
+#include <stdint.h>
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
@@ -33,6 +34,23 @@
extern char *optarg;
extern int optind;
#endif
+#if defined(__sortix__)
+#define F_UNLCK 0
+#define F_RDLCK 1
+#define F_WRLCK 2
+#define F_GETLK 1000
+#define F_SETLK 1001
+#define F_SETLKW 1002
+struct flock
+{
+ short l_type;
+ short l_whence;
+ off_t l_start;
+ off_t l_len;
+ pid_t l_pid;
+};
+#define fcntl(...) 0
+#endif
#include "uuid/uuid.h"
#include "uuid/uuidd.h"
#include "support/nls-enable.h"
@@ -82,9 +100,11 @@
if (chdir("/")) {} /* Silence warn_unused_result warning */
(void) setsid();
+#if !defined(__sortix__)
euid = geteuid();
if (setreuid(euid, euid) < 0)
die("setreuid");
+#endif
}
static ssize_t read_all(int fd, char *buf, size_t count)
@@ -328,7 +348,7 @@
signal(SIGALRM, terminate_intr);
signal(SIGPIPE, SIG_IGN);
- sprintf(reply_buf, "%8d\n", getpid());
+ sprintf(reply_buf, "%8jd\n", (intmax_t) getpid());
if (ftruncate(fd_pidfile, 0)) {} /* Silence warn_unused_result */
write_all(fd_pidfile, reply_buf, strlen(reply_buf));
if (fd_pidfile > 1)
@@ -366,7 +386,7 @@
switch(op) {
case UUIDD_OP_GETPID:
- sprintf(reply_buf, "%d", getpid());
+ sprintf(reply_buf, "%jd", (intmax_t) getpid());
reply_len = strlen(reply_buf)+1;
break;
case UUIDD_OP_GET_MAXOP:
@@ -515,17 +535,21 @@
if (setresgid(gid, gid, gid) < 0)
die("setresgid");
#else
+#if !defined(__sortix__)
if (setregid(gid, gid) < 0)
die("setregid");
#endif
+#endif
#ifdef HAVE_SETRESUID
if (setresuid(uid, uid, uid) < 0)
die("setresuid");
#else
+#if !defined(__sortix__)
if (setreuid(uid, uid) < 0)
die("setreuid");
#endif
+#endif
}
if (num && do_type) {
ret = call_daemon(socket_path, do_type+2, buf,
diff -Paur --no-dereference -- e2fsprogs.upstream/resize/resource_track.c e2fsprogs/resize/resource_track.c
--- e2fsprogs.upstream/resize/resource_track.c
+++ e2fsprogs/resize/resource_track.c
@@ -27,7 +27,7 @@
io_stats io_start = 0;
track->desc = desc;
- track->brk_start = sbrk(0);
+ track->brk_start = 0;
gettimeofday(&track->time_start, 0);
#ifdef HAVE_GETRUSAGE
#ifdef sun
@@ -92,7 +92,7 @@
kbytes(malloc_info.uordblks), kbytes(malloc_info.fordblks));
#else
printf("Memory used: %lu, ",
- (unsigned long) (((char *) sbrk(0)) -
+ (unsigned long) (((char *) 0) -
((char *) track->brk_start)));
#endif
#ifdef HAVE_GETRUSAGE
diff -Paur --no-dereference -- e2fsprogs.upstream/util/subst.c e2fsprogs/util/subst.c
--- e2fsprogs.upstream/util/subst.c
+++ e2fsprogs/util/subst.c
@@ -390,13 +390,8 @@
if (fd > 0) {
/* save the original atime, if possible */
if (fstat(fd, &stbuf) == 0) {
-#if HAVE_STRUCT_STAT_ST_ATIM
tv[0].tv_sec = stbuf.st_atim.tv_sec;
tv[0].tv_usec = stbuf.st_atim.tv_nsec / 1000;
-#else
- tv[0].tv_sec = stbuf.st_atime;
- tv[0].tv_usec = 0;
-#endif
got_atime = 1;
}
old = fdopen(fd, "r");