summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2023-01-27 12:42:47 -0500
committerTheodore Ts'o <tytso@mit.edu>2023-01-27 12:42:47 -0500
commit8f4f9f0ec5bd53973043bced10e57b471db32632 (patch)
tree77b0d63c1ef23c9730c2c67a685534e5bc8cc2a1
parentd37a9f1818fa04fc91a497b3541ed205804720af (diff)
parent9fd9c75204c5c1c021fa9911b787e62e9657802e (diff)
downloade2fsprogs-8f4f9f0ec5bd53973043bced10e57b471db32632.tar.gz
Merge branch 'maint' into next
-rw-r--r--.github/workflows/ci.yml116
-rw-r--r--aclocal.m434
-rwxr-xr-xconfig/install-sh683
-rwxr-xr-xconfigure195
-rw-r--r--configure.ac78
-rw-r--r--debian/control2
-rw-r--r--debugfs/debugfs.8.in2
-rw-r--r--debugfs/debugfs.c2
-rw-r--r--doc/libext2fs.texinfo4
-rw-r--r--doc/texinfo.tex12
-rw-r--r--e2fsck/dirinfo.c2
-rw-r--r--e2fsck/dx_dirinfo.c2
-rw-r--r--e2fsck/e2fsck.h2
-rw-r--r--e2fsck/jfs_user.h62
-rw-r--r--e2fsck/journal.c5
-rw-r--r--e2fsck/pass1.c2
-rw-r--r--e2fsck/pass1b.c73
-rw-r--r--e2fsck/pass2.c2
-rw-r--r--e2fsck/rehash.c10
-rw-r--r--ext2ed/doc/ext2ed-design.sgml2
-rw-r--r--include/mingw/arpa/inet.h5
-rw-r--r--include/mingw/sys/sysmacros.h8
-rw-r--r--lib/blkid/Android.bp1
-rw-r--r--lib/blkid/devno.c10
-rw-r--r--lib/blkid/getsize.c2
-rw-r--r--lib/blkid/probe.c10
-rw-r--r--lib/blkid/probe.h43
-rw-r--r--lib/blkid/save.c8
-rw-r--r--lib/config.h.in109
-rw-r--r--lib/e2p/Android.bp4
-rw-r--r--lib/e2p/fgetversion.c2
-rw-r--r--lib/e2p/fsetversion.c1
-rw-r--r--lib/e2p/getflags.c3
-rw-r--r--lib/e2p/getversion.c1
-rw-r--r--lib/e2p/setversion.c1
-rw-r--r--lib/et/Android.bp3
-rw-r--r--lib/et/error_message.c10
-rw-r--r--lib/et/texinfo.tex12
-rw-r--r--lib/ext2fs/Android.bp2
-rw-r--r--lib/ext2fs/bitops.c14
-rw-r--r--lib/ext2fs/bitops.h97
-rw-r--r--lib/ext2fs/ext2_io.h2
-rw-r--r--lib/ext2fs/ext2fs.h4
-rw-r--r--lib/ext2fs/ext2fsP.h2
-rw-r--r--lib/ext2fs/gen_bitmap64.c16
-rw-r--r--lib/ext2fs/getsectsize.c12
-rw-r--r--lib/ext2fs/inline_data.c2
-rw-r--r--lib/ext2fs/irel.h2
-rw-r--r--lib/ext2fs/ismounted.c12
-rw-r--r--lib/ext2fs/jfs_compat.h4
-rw-r--r--lib/ext2fs/kernel-jbd.h2
-rw-r--r--lib/ext2fs/mmp.c4
-rw-r--r--lib/ext2fs/nls_utf8.c2
-rw-r--r--lib/ext2fs/sha256.c2
-rw-r--r--lib/ext2fs/sha512.c2
-rw-r--r--lib/ext2fs/windows_io.c12
-rw-r--r--lib/ss/Makefile.in5
-rw-r--r--lib/ss/execute_cmd.c2
-rw-r--r--lib/ss/help.c2
-rw-r--r--lib/ss/pager.c2
-rw-r--r--lib/support/devname.c1
-rw-r--r--lib/support/plausible.c7
-rw-r--r--lib/support/print_fs_flags.c60
-rw-r--r--lib/support/profile.c2
-rw-r--r--lib/support/quotaio_v2.c2
-rw-r--r--lib/support/sort_r.h6
-rw-r--r--lib/uuid/gen_uuid.c21
-rw-r--r--misc/Android.bp3
-rw-r--r--misc/base_device.c2
-rw-r--r--misc/create_inode.c38
-rw-r--r--misc/e4defrag.c30
-rw-r--r--misc/fsck.c2
-rw-r--r--misc/fuse2fs.c5
-rw-r--r--misc/mk_hugefiles.c134
-rw-r--r--misc/mke2fs.c24
-rw-r--r--misc/tune2fs.c31
-rw-r--r--misc/util.c5
-rw-r--r--resize/resize2fs.c4
-rw-r--r--scrub/e2scrub.8.in2
-rw-r--r--scrub/e2scrub.in2
-rw-r--r--scrub/e2scrub_all.8.in2
-rw-r--r--tests/README2
-rw-r--r--tests/f_badjour_encrypted/expect.130
-rw-r--r--tests/f_badjour_encrypted/expect.27
-rw-r--r--tests/f_badjour_encrypted/name1
-rw-r--r--tests/f_badjour_encrypted/script11
-rw-r--r--tests/f_dup_resize/expect.13
-rw-r--r--util/android_config.h1
-rw-r--r--util/mkutf8data.c2
-rw-r--r--util/subst.c4
90 files changed, 1294 insertions, 877 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 00000000..29482178
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,116 @@
+name: CI
+on: [push]
+env:
+ DEF_CFLAGS: -O2 -g -Wall
+
+jobs:
+ gcc-build-and-test:
+ name: Build and test with gcc
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - run: ./configure CC=gcc CFLAGS="$DEF_CFLAGS"
+ - run: make -j8 check V=1 CFLAGS="$DEF_CFLAGS -Werror"
+ - run: make -j8 install V=1 DESTDIR=$PWD/installdir
+ - run: make -j8 uninstall V=1 DESTDIR=$PWD/installdir
+
+ clang-build-and-test:
+ name: Build and test with clang
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y clang
+ - run: ./configure CC=clang CFLAGS="$DEF_CFLAGS"
+ - run: make -j8 check V=1 CFLAGS="$DEF_CFLAGS -Werror"
+ - run: make -j8 install V=1 DESTDIR=$PWD/installdir
+ - run: make -j8 uninstall V=1 DESTDIR=$PWD/installdir
+
+ i386-build-and-test:
+ name: Build and test with gcc -m32
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y gcc-multilib
+ - run: ./configure CC=gcc CFLAGS="$DEF_CFLAGS -m32" LDFLAGS="-m32"
+ - run: make -j8 check V=1 CFLAGS="$DEF_CFLAGS -m32 -Werror"
+ - run: make -j8 install V=1 DESTDIR=$PWD/installdir
+ - run: make -j8 uninstall V=1 DESTDIR=$PWD/installdir
+
+ asan-build-and-test:
+ name: Build and test with ASAN enabled
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y clang
+ - run: echo "ASAN_CFLAGS=$DEF_CFLAGS -fsanitize=address -fno-sanitize-recover=address" >> $GITHUB_ENV
+ - run: ./configure CC=clang CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS"
+ - run: make -j8 check V=1 CFLAGS="$ASAN_CFLAGS -Werror"
+
+ ubsan-build-and-test:
+ name: Build and test with UBSAN enabled
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y clang
+ - run: echo "UBSAN_CFLAGS=$DEF_CFLAGS -fsanitize=undefined -fno-sanitize-recover=undefined" >> $GITHUB_ENV
+ - run: ./configure CC=clang CFLAGS="$UBSAN_CFLAGS" LDFLAGS="$UBSAN_CFLAGS"
+ - run: make -j8 check V=1 CFLAGS="$UBSAN_CFLAGS -Werror"
+
+ macos-build-and-test:
+ name: Build and test on macOS
+ runs-on: macos-latest
+ steps:
+ - uses: actions/checkout@v2
+ - run: ./configure CFLAGS="$DEF_CFLAGS"
+ # -Wno-error=deprecated-declarations is needed to suppress known warnings
+ # due to e2fsprogs' use of sbrk(0) and daemon().
+ - run: make -j8 check V=1 CFLAGS="$DEF_CFLAGS -Werror -Wno-error=deprecated-declarations"
+ - run: make -j8 install DESTDIR=$PWD/installdir
+ - run: make -j8 uninstall DESTDIR=$PWD/installdir
+
+ windows-msys2-build:
+ name: Build mke2fs on Windows with ${{matrix.sys}}
+ runs-on: windows-latest
+ strategy:
+ matrix:
+ include:
+ - { sys: mingw32, env: i686 }
+ - { sys: mingw64, env: x86_64 }
+ defaults:
+ run:
+ shell: msys2 {0}
+ steps:
+ - uses: actions/checkout@v2
+ - uses: msys2/setup-msys2@v2
+ with:
+ msystem: ${{matrix.sys}}
+ update: true
+ install: >
+ make
+ mingw-w64-${{matrix.env}}-cc
+ # For now the only parts that actually build for Windows are mke2fs and its
+ # dependencies: all libraries except libss. The build system doesn't want
+ # to build just those parts, though, so do it one step at a time...
+ - run: ./configure CFLAGS="$DEF_CFLAGS"
+ - run: make -j8 subs V=1 CFLAGS="$DEF_CFLAGS -Werror"
+ - run: make -j8 -C lib/et/ all V=1 CFLAGS="$DEF_CFLAGS -Werror"
+ - run: make -j8 -C lib/uuid/ all V=1 CFLAGS="$DEF_CFLAGS -Werror"
+ - run: make -j8 -C lib/blkid/ all V=1 CFLAGS="$DEF_CFLAGS -Werror"
+ - run: make -j8 -C lib/ext2fs/ all V=1 CFLAGS="$DEF_CFLAGS -Werror"
+ - run: make -j8 -C lib/support/ all V=1 CFLAGS="$DEF_CFLAGS -Werror"
+ - run: make -j8 -C lib/e2p/ all V=1 CFLAGS="$DEF_CFLAGS -Werror"
+ - run: make -j8 -C misc/ mke2fs V=1 CFLAGS="$DEF_CFLAGS -Werror"
+ - run: touch image.ext4
+ - run: misc/mke2fs.exe -T ext4 image.ext4 128M
diff --git a/aclocal.m4 b/aclocal.m4
index bd5778d5..b5f5cecc 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -3277,8 +3277,8 @@ AC_DEFUN([AM_NLS],
AC_SUBST([USE_NLS])
])
-# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
-# serial 11 (pkg-config-0.29.1)
+# pkg.m4 - Macros to locate and use pkg-config. -*- Autoconf -*-
+# serial 12 (pkg-config-0.29.2)
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
@@ -3320,7 +3320,7 @@ dnl
dnl See the "Since" comment for each macro you use to see what version
dnl of the macros you require.
m4_defun([PKG_PREREQ],
-[m4_define([PKG_MACROS_VERSION], [0.29.1])
+[m4_define([PKG_MACROS_VERSION], [0.29.2])
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
])dnl PKG_PREREQ
@@ -3365,7 +3365,7 @@ dnl Check to see whether a particular set of modules exists. Similar to
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
dnl
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-dnl only at the first occurence in configure.ac, so if the first place
+dnl only at the first occurrence in configure.ac, so if the first place
dnl it's called might be skipped (such as if it is within an "if", you
dnl have to call PKG_CHECK_EXISTS manually
AC_DEFUN([PKG_CHECK_EXISTS],
@@ -3421,7 +3421,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no
-AC_MSG_CHECKING([for $1])
+AC_MSG_CHECKING([for $2])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
@@ -3431,17 +3431,17 @@ and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
- AC_MSG_RESULT([no])
+ AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
- $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
- else
- $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
+ else
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
- # Put the nasty error message in config.log where it belongs
- echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+ # Put the nasty error message in config.log where it belongs
+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
- m4_default([$4], [AC_MSG_ERROR(
+ m4_default([$4], [AC_MSG_ERROR(
[Package requirements ($2) were not met:
$$1_PKG_ERRORS
@@ -3452,8 +3452,8 @@ installed software in a non-standard prefix.
_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
- AC_MSG_RESULT([no])
- m4_default([$4], [AC_MSG_FAILURE(
+ AC_MSG_RESULT([no])
+ m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
@@ -3463,10 +3463,10 @@ _PKG_TEXT
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
])
else
- $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
- $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes])
- $3
+ $3
fi[]dnl
])dnl PKG_CHECK_MODULES
diff --git a/config/install-sh b/config/install-sh
index 89fc9b09..ec298b53 100755
--- a/config/install-sh
+++ b/config/install-sh
@@ -1,238 +1,541 @@
-#! /bin/sh
-#
+#!/bin/sh
# install - install a program, script, or datafile
-# This comes from X11R5.
+
+scriptversion=2020-11-14.01; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
+# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
-#
+tab=' '
+nl='
+'
+IFS=" $tab$nl"
+
+# Set DOITPROG to "echo" to test this script.
+
+doit=${DOITPROG-}
+doit_exec=${doit:-exec}
-# set DOITPROG to echo to test this script
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+posix_mkdir=
-# put in absolute paths if you don't have them in your path; or use env. vars.
+# Desired mode of installed file.
+mode=0755
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
+# Create dirs (including intermediate dirs) using mode 755.
+# This is like GNU 'install' as of coreutils 8.32 (2020).
+mkdir_umask=22
-tranformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
+backupsuffix=
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd="$cpprog"
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd="$stripprog"
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
+stripcmd=
-if [ x"$src" = x ]
-then
- echo "install: no input file specified"
- exit 1
-else
- true
-fi
+src=
+dst=
+dir_arg=
+dst_arg=
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d $dst ]; then
- instcmd=:
- else
- instcmd=mkdir
- fi
-else
+copy_on_change=false
+is_target_a_directory=possibly
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
- if [ -f $src -o -d $src ]
- then
- true
- else
- echo "install: $src does not exist"
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "install: no destination specified"
- exit 1
- else
- true
- fi
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
+Options:
+ --help display this help and exit.
+ --version display version info and exit.
- if [ -d $dst ]
- then
- dst="$dst"/`basename $src`
- else
- true
- fi
-fi
+ -c (ignored)
+ -C install only if different (preserve data modification time)
+ -d create directories instead of installing files.
+ -g GROUP $chgrpprog installed files to GROUP.
+ -m MODE $chmodprog installed files to MODE.
+ -o USER $chownprog installed files to USER.
+ -p pass -p to $cpprog.
+ -s $stripprog installed files.
+ -S SUFFIX attempt to back up existing files, with suffix SUFFIX.
+ -t DIRECTORY install into DIRECTORY.
+ -T report an error if DSTFILE is a directory.
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+ RMPROG STRIPPROG
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
+By default, rm is invoked with -f; when overridden with RMPROG,
+it's up to you to specify -f if you want it.
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
-IFS="${IFS-${defaultIFS}}"
+If -S is not specified, no backups are attempted.
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
+Email bug reports to bug-automake@gnu.org.
+Automake home page: https://www.gnu.org/software/automake/
+"
-pathcomp=''
+while test $# -ne 0; do
+ case $1 in
+ -c) ;;
-while [ $# -ne 0 ] ; do
- pathcomp="${pathcomp}${1}"
- shift
+ -C) copy_on_change=true;;
- if [ ! -d "${pathcomp}" ] ;
- then
- $mkdirprog "${pathcomp}"
- else
- true
- fi
+ -d) dir_arg=true;;
- pathcomp="${pathcomp}/"
-done
-fi
+ -g) chgrpcmd="$chgrpprog $2"
+ shift;;
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd $dst &&
+ --help) echo "$usage"; exit $?;;
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
+ -m) mode=$2
+ case $mode in
+ *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
-# If we're going to rename the final executable, determine the name now.
+ -o) chowncmd="$chownprog $2"
+ shift;;
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
- else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
- fi
+ -p) cpprog="$cpprog -p";;
-# don't allow the sed command to completely eliminate the filename
+ -s) stripcmd=$stripprog;;
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
- else
- true
- fi
+ -S) backupsuffix="$2"
+ shift;;
-# Make a temp file name in the proper directory.
+ -t)
+ is_target_a_directory=always
+ dst_arg=$2
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ shift;;
- dsttmp=$dstdir/#inst.$$#
+ -T) is_target_a_directory=never;;
-# Move or copy the file name to the temp name
+ --version) echo "$0 $scriptversion"; exit $?;;
- $doit $instcmd $src $dsttmp &&
+ --) shift
+ break;;
- trap "rm -f ${dsttmp}" 0 &&
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
-# and set any options; do chmod last to preserve setuid bits
+ *) break;;
+ esac
+ shift
+done
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
+# We allow the use of options -d and -T together, by making -d
+# take the precedence; this is for compatibility with GNU install.
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+if test -n "$dir_arg"; then
+ if test -n "$dst_arg"; then
+ echo "$0: target directory not allowed when installing a directory." >&2
+ exit 1
+ fi
+fi
-# Now rename the file to the real destination.
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+ # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dst_arg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dst_arg"
+ shift # fnord
+ fi
+ shift # arg
+ dst_arg=$arg
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ done
+fi
- $doit $rmcmd -f $dstdir/$dstfile &&
- $doit $mvcmd $dsttmp $dstdir/$dstfile
+if test $# -eq 0; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call 'install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
-fi &&
+if test -z "$dir_arg"; then
+ if test $# -gt 1 || test "$is_target_a_directory" = always; then
+ if test ! -d "$dst_arg"; then
+ echo "$0: $dst_arg: Is not a directory." >&2
+ exit 1
+ fi
+ fi
+fi
+
+if test -z "$dir_arg"; then
+ do_exit='(exit $ret); exit $ret'
+ trap "ret=129; $do_exit" 1
+ trap "ret=130; $do_exit" 2
+ trap "ret=141; $do_exit" 13
+ trap "ret=143; $do_exit" 15
+
+ # Set umask so as not to create temps with too-generous modes.
+ # However, 'strip' requires both read and write access to temps.
+ case $mode in
+ # Optimize common cases.
+ *644) cp_umask=133;;
+ *755) cp_umask=22;;
+
+ *[0-7])
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw='% 200'
+ fi
+ cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+ *)
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw=,u+rw
+ fi
+ cp_umask=$mode$u_plus_rw;;
+ esac
+fi
+for src
+do
+ # Protect names problematic for 'test' and other utilities.
+ case $src in
+ -* | [=\(\)!]) src=./$src;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ dstdir=$dst
+ test -d "$dstdir"
+ dstdir_status=$?
+ # Don't chown directories that already exist.
+ if test $dstdir_status = 0; then
+ chowncmd=""
+ fi
+ else
+
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dst_arg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+ dst=$dst_arg
+
+ # If destination is a directory, append the input filename.
+ if test -d "$dst"; then
+ if test "$is_target_a_directory" = never; then
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
+ fi
+ dstdir=$dst
+ dstbase=`basename "$src"`
+ case $dst in
+ */) dst=$dst$dstbase;;
+ *) dst=$dst/$dstbase;;
+ esac
+ dstdir_status=0
+ else
+ dstdir=`dirname "$dst"`
+ test -d "$dstdir"
+ dstdir_status=$?
+ fi
+ fi
+
+ case $dstdir in
+ */) dstdirslash=$dstdir;;
+ *) dstdirslash=$dstdir/;;
+ esac
+
+ obsolete_mkdir_used=false
+
+ if test $dstdir_status != 0; then
+ case $posix_mkdir in
+ '')
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ # The $RANDOM variable is not portable (e.g., dash). Use it
+ # here however when possible just to lower collision chance.
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+
+ trap '
+ ret=$?
+ rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
+ exit $ret
+ ' 0
+
+ # Because "mkdir -p" follows existing symlinks and we likely work
+ # directly in world-writeable /tmp, make sure that the '$tmpdir'
+ # directory is successfully created first before we actually test
+ # 'mkdir -p'.
+ if (umask $mkdir_umask &&
+ $mkdirprog $mkdir_mode "$tmpdir" &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ test_tmpdir="$tmpdir/a"
+ ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
+ fi
+ trap '' 0;;
+ esac
+
+ if
+ $posix_mkdir && (
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ )
+ then :
+ else
+
+ # mkdir does not conform to POSIX,
+ # or it failed possibly due to a race condition. Create the
+ # directory the slow way, step by step, checking for races as we go.
+
+ case $dstdir in
+ /*) prefix='/';;
+ [-=\(\)!]*) prefix='./';;
+ *) prefix='';;
+ esac
+
+ oIFS=$IFS
+ IFS=/
+ set -f
+ set fnord $dstdir
+ shift
+ set +f
+ IFS=$oIFS
+
+ prefixes=
+
+ for d
+ do
+ test X"$d" = X && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
+ done
+
+ if test -n "$prefixes"; then
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
+ fi
+ fi
+ fi
+
+ if test -n "$dir_arg"; then
+ { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+ { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+ else
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=${dstdirslash}_inst.$$_
+ rmtmp=${dstdirslash}_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+ # Copy the file name to the temp name.
+ (umask $cp_umask &&
+ { test -z "$stripcmd" || {
+ # Create $dsttmp read-write so that cp doesn't create it read-only,
+ # which would cause strip to fail.
+ if test -z "$doit"; then
+ : >"$dsttmp" # No need to fork-exec 'touch'.
+ else
+ $doit touch "$dsttmp"
+ fi
+ }
+ } &&
+ $doit_exec $cpprog "$src" "$dsttmp") &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+ { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+ { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+ # If -C, don't bother to copy if it wouldn't change the file.
+ if $copy_on_change &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+ set -f &&
+ set X $old && old=:$2:$4:$5:$6 &&
+ set X $new && new=:$2:$4:$5:$6 &&
+ set +f &&
+ test "$old" = "$new" &&
+ $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+ then
+ rm -f "$dsttmp"
+ else
+ # If $backupsuffix is set, and the file being installed
+ # already exists, attempt a backup. Don't worry if it fails,
+ # e.g., if mv doesn't support -f.
+ if test -n "$backupsuffix" && test -f "$dst"; then
+ $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
+ fi
+
+ # Rename the file to the real destination.
+ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+ {
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
+ }
+ fi || exit 1
+
+ trap '' 0
+ fi
+done
-exit 0
+# Local variables:
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC0"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/configure b/configure
index 49354236..b3343966 100755
--- a/configure
+++ b/configure
@@ -7956,31 +7956,47 @@ fi
# Check whether --enable-tdb was given.
if test ${enable_tdb+y}
then :
- enableval=$enable_tdb; if test "$enableval" = "no"
+ enableval=$enable_tdb;
+if test "$enableval" = "no"
then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Disabling tdb support" >&5
printf "%s\n" "Disabling tdb support" >&6; }
- TDB_CMT="#"
- TDB_MAN_COMMENT='.\"'
+ CONFIG_TDB=0
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Enabling tdb support" >&5
printf "%s\n" "Enabling tdb support" >&6; }
- printf "%s\n" "#define CONFIG_TDB 1" >>confdefs.h
-
- TDB_CMT=""
- TDB_MAN_COMMENT=""
+ CONFIG_TDB=1
fi
+
else $as_nop
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Enabling mmp support by default" >&5
-printf "%s\n" "Enabling mmp support by default" >&6; }
-printf "%s\n" "#define CONFIG_TDB 1" >>confdefs.h
-TDB_CMT=""
-TDB_MAN_COMMENT=""
+case "$host_os" in
+mingw*)
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Disabling tdb support by default" >&5
+printf "%s\n" "Disabling tdb support by default" >&6; }
+ CONFIG_TDB=0
+ ;;
+*)
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Enabling tdb support by default" >&5
+printf "%s\n" "Enabling tdb support by default" >&6; }
+ CONFIG_TDB=1
+ ;;
+esac
+
fi
+if test "$CONFIG_TDB" = "1"
+then
+ printf "%s\n" "#define CONFIG_TDB 1" >>confdefs.h
+
+ TDB_CMT=""
+ TDB_MAN_COMMENT=""
+else
+ TDB_CMT="#"
+ TDB_MAN_COMMENT='.\"'
+fi
@@ -12117,6 +12133,22 @@ then :
fi
+case "$host_os" in
+mingw*)
+ # The above checks only detect system headers, not the headers in
+ # ./include/mingw/, so explicitly define them to be available.
+ printf "%s\n" "#define HAVE_LINUX_TYPES_H 1" >>confdefs.h
+
+ printf "%s\n" "#define HAVE_SYS_STAT_H 1" >>confdefs.h
+
+ printf "%s\n" "#define HAVE_SYS_SYSMACROS_H 1" >>confdefs.h
+
+ printf "%s\n" "#define HAVE_SYS_TYPES_H 1" >>confdefs.h
+
+ printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h
+
+ ;;
+esac
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a dd(1) program that supports iflag=fullblock" >&5
printf %s "checking for a dd(1) program that supports iflag=fullblock... " >&6; }
DD=
@@ -13270,6 +13302,12 @@ then :
printf "%s\n" "#define HAVE_PWRITE64 1" >>confdefs.h
fi
+ac_fn_c_check_func "$LINENO" "qsort_r" "ac_cv_func_qsort_r"
+if test "x$ac_cv_func_qsort_r" = xyes
+then :
+ printf "%s\n" "#define HAVE_QSORT_R 1" >>confdefs.h
+
+fi
ac_fn_c_check_func "$LINENO" "secure_getenv" "ac_cv_func_secure_getenv"
if test "x$ac_cv_func_secure_getenv" = xyes
then :
@@ -13951,6 +13989,92 @@ fi
fi
fi
+if test "$ac_cv_func_qsort_r" != no
+then :
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether qsort_r is GNU version" >&5
+printf %s "checking whether qsort_r is GNU version... " >&6; }
+if test ${e2_cv_gnu_qsort_r+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <stdlib.h>
+void (qsort_r)(void *base, size_t nmemb, size_t size,
+ int (*compar)(const void *, const void *, void *),
+ void *arg);
+
+int
+main (void)
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ e2_cv_gnu_qsort_r=yes
+else $as_nop
+ e2_cv_gnu_qsort_r=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $e2_cv_gnu_qsort_r" >&5
+printf "%s\n" "$e2_cv_gnu_qsort_r" >&6; }
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether qsort_r is BSD version" >&5
+printf %s "checking whether qsort_r is BSD version... " >&6; }
+if test ${e2_cv_bsd_qsort_r+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <stdlib.h>
+void (qsort_r)(void *base, size_t nmemb, size_t size,
+ void *arg, int (*compar)(void *, const void *, const void *));
+
+int
+main (void)
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ e2_cv_bsd_qsort_r=yes
+else $as_nop
+ e2_cv_bsd_qsort_r=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $e2_cv_bsd_qsort_r" >&5
+printf "%s\n" "$e2_cv_bsd_qsort_r" >&6; }
+ case "$e2_cv_gnu_qsort_r:$e2_cv_bsd_qsort_r" in #(
+ yes:no) :
+
+
+printf "%s\n" "#define HAVE_GNU_QSORT_R 1" >>confdefs.h
+
+ ;; #(
+ no:yes) :
+
+
+printf "%s\n" "#define HAVE_BSD_QSORT_R 1" >>confdefs.h
+
+ ;; #(
+ *) :
+ ;;
+esac
+
+fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for unified diff option" >&5
printf %s "checking for unified diff option... " >&6; }
if diff -u $0 $0 > /dev/null 2>&1 ; then
@@ -14650,11 +14774,11 @@ if test x$ac_prog_cxx_stdcxx = xno
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5
printf %s "checking for $CXX option to enable C++11 features... " >&6; }
-if test ${ac_cv_prog_cxx_11+y}
+if test ${ac_cv_prog_cxx_cxx11+y}
then :
printf %s "(cached) " >&6
else $as_nop
- ac_cv_prog_cxx_11=no
+ ac_cv_prog_cxx_cxx11=no
ac_save_CXX=$CXX
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -14696,11 +14820,11 @@ if test x$ac_prog_cxx_stdcxx = xno
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5
printf %s "checking for $CXX option to enable C++98 features... " >&6; }
-if test ${ac_cv_prog_cxx_98+y}
+if test ${ac_cv_prog_cxx_cxx98+y}
then :
printf %s "(cached) " >&6
else $as_nop
- ac_cv_prog_cxx_98=no
+ ac_cv_prog_cxx_cxx98=no
ac_save_CXX=$CXX
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -14963,6 +15087,11 @@ fi
if test -n "$WITH_DIET_LIBC" ; then
INCLUDES="$INCLUDES -D_REENTRANT"
fi
+case "$host_os" in
+mingw*)
+ INCLUDES=$INCLUDES' -I$(top_srcdir)/include/mingw'
+ ;;
+esac
if test $cross_compiling = no; then
BUILD_CFLAGS="$CFLAGS $CPPFLAGS $INCLUDES -DHAVE_CONFIG_H"
@@ -15035,7 +15164,7 @@ fi
if test $pkg_failed = yes; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -15044,25 +15173,25 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- udev_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "udev" 2>&1`
+ udev_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "udev" 2>&1`
else
- udev_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "udev" 2>&1`
+ udev_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "udev" 2>&1`
fi
- # Put the nasty error message in config.log where it belongs
- echo "$udev_PKG_ERRORS" >&5
+ # Put the nasty error message in config.log where it belongs
+ echo "$udev_PKG_ERRORS" >&5
with_udev_rules_dir=""
elif test $pkg_failed = untried; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
with_udev_rules_dir=""
else
- udev_CFLAGS=$pkg_cv_udev_CFLAGS
- udev_LIBS=$pkg_cv_udev_LIBS
+ udev_CFLAGS=$pkg_cv_udev_CFLAGS
+ udev_LIBS=$pkg_cv_udev_LIBS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
@@ -15204,7 +15333,7 @@ fi
if test $pkg_failed = yes; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -15213,25 +15342,25 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- systemd_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "systemd" 2>&1`
+ systemd_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "systemd" 2>&1`
else
- systemd_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "systemd" 2>&1`
+ systemd_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "systemd" 2>&1`
fi
- # Put the nasty error message in config.log where it belongs
- echo "$systemd_PKG_ERRORS" >&5
+ # Put the nasty error message in config.log where it belongs
+ echo "$systemd_PKG_ERRORS" >&5
with_systemd_unit_dir=""
elif test $pkg_failed = untried; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
with_systemd_unit_dir=""
else
- systemd_CFLAGS=$pkg_cv_systemd_CFLAGS
- systemd_LIBS=$pkg_cv_systemd_LIBS
+ systemd_CFLAGS=$pkg_cv_systemd_CFLAGS
+ systemd_LIBS=$pkg_cv_systemd_LIBS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
@@ -15268,7 +15397,7 @@ fi
OS_IO_FILE=""
case "$host_os" in
- cigwin*|mingw*|msys*)
+ mingw*)
OS_IO_FILE=windows_io
;;
*)
diff --git a/configure.ac b/configure.ac
index 78f71fd8..cc6f681e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -845,23 +845,39 @@ dnl
AH_TEMPLATE([CONFIG_TDB], [Define to 1 to enable tdb support])
AC_ARG_ENABLE([tdb],
AS_HELP_STRING([--disable-tdb],[disable tdb support]),
+[
if test "$enableval" = "no"
then
AC_MSG_RESULT([Disabling tdb support])
- TDB_CMT="#"
- TDB_MAN_COMMENT='.\"'
+ CONFIG_TDB=0
else
AC_MSG_RESULT([Enabling tdb support])
+ CONFIG_TDB=1
+fi
+]
+,
+[
+case "$host_os" in
+mingw*)
+ AC_MSG_RESULT([Disabling tdb support by default])
+ CONFIG_TDB=0
+ ;;
+*)
+ AC_MSG_RESULT([Enabling tdb support by default])
+ CONFIG_TDB=1
+ ;;
+esac
+]
+)
+if test "$CONFIG_TDB" = "1"
+then
AC_DEFINE(CONFIG_TDB, 1)
TDB_CMT=""
TDB_MAN_COMMENT=""
+else
+ TDB_CMT="#"
+ TDB_MAN_COMMENT='.\"'
fi
-,
-AC_MSG_RESULT([Enabling mmp support by default])
-AC_DEFINE(CONFIG_TDB, 1)
-TDB_CMT=""
-TDB_MAN_COMMENT=""
-)
AC_SUBST(TDB_CMT)
AC_SUBST(TDB_MAN_COMMENT)
dnl
@@ -1020,6 +1036,17 @@ AC_CHECK_HEADERS(m4_flatten([
sys/wait.h
sys/xattr.h
]))
+case "$host_os" in
+mingw*)
+ # The above checks only detect system headers, not the headers in
+ # ./include/mingw/, so explicitly define them to be available.
+ AC_DEFINE(HAVE_LINUX_TYPES_H, 1)
+ AC_DEFINE(HAVE_SYS_STAT_H, 1)
+ AC_DEFINE(HAVE_SYS_SYSMACROS_H, 1)
+ AC_DEFINE(HAVE_SYS_TYPES_H, 1)
+ AC_DEFINE(HAVE_UNISTD_H, 1)
+ ;;
+esac
dnl Check where to find a dd(1) that supports iflag=fullblock
dnl and oflag=append
AC_MSG_CHECKING([for a dd(1) program that supports iflag=fullblock])
@@ -1226,6 +1253,7 @@ AC_CHECK_FUNCS(m4_flatten([
pwrite
pread64
pwrite64
+ qsort_r
secure_getenv
setmntent
setresgid
@@ -1351,6 +1379,33 @@ then
fi
AC_SUBST(SEM_INIT_LIB)
dnl
+dnl qsort_r detection
+dnl
+AS_IF([test "$ac_cv_func_qsort_r" != no], [
+ AC_CACHE_CHECK(whether qsort_r is GNU version, e2_cv_gnu_qsort_r,
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+@%:@include <stdlib.h>
+void (qsort_r)(void *base, size_t nmemb, size_t size,
+ int (*compar)(const void *, const void *, void *),
+ void *arg);
+]], [[ ]])],[e2_cv_gnu_qsort_r=yes],[e2_cv_gnu_qsort_r=no])
+ ])
+ AC_CACHE_CHECK(whether qsort_r is BSD version, e2_cv_bsd_qsort_r,
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+@%:@include <stdlib.h>
+void (qsort_r)(void *base, size_t nmemb, size_t size,
+ void *arg, int (*compar)(void *, const void *, const void *));
+]], [[ ]])],[e2_cv_bsd_qsort_r=yes],[e2_cv_bsd_qsort_r=no])
+ ])
+ AS_CASE("$e2_cv_gnu_qsort_r:$e2_cv_bsd_qsort_r",
+ [yes:no], [
+ AC_DEFINE(HAVE_GNU_QSORT_R, 1, [ Define to 1 if you have the GNU-style 'qsort_r' function.])
+ ],
+ [no:yes], [
+ AC_DEFINE(HAVE_BSD_QSORT_R, 1, [ Define to 1 if you have the BSD-style 'qsort_r' function.])
+ ])
+])
+dnl
dnl Check for unified diff
dnl
AC_MSG_CHECKING(for unified diff option)
@@ -1694,6 +1749,11 @@ fi
if test -n "$WITH_DIET_LIBC" ; then
INCLUDES="$INCLUDES -D_REENTRANT"
fi
+case "$host_os" in
+mingw*)
+ INCLUDES=$INCLUDES' -I$(top_srcdir)/include/mingw'
+ ;;
+esac
AC_SUBST(INCLUDES)
dnl
dnl Build CFLAGS
@@ -1826,7 +1886,7 @@ dnl Adjust the compiled files if we are on windows vs everywhere else
dnl
OS_IO_FILE=""
[case "$host_os" in
- cigwin*|mingw*|msys*)
+ mingw*)
OS_IO_FILE=windows_io
;;
*)
diff --git a/debian/control b/debian/control
index 5a13b566..671a6011 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,7 @@ Priority: required
Maintainer: Theodore Y. Ts'o <tytso@mit.edu>
Build-Depends: gettext, texinfo, pkg-config, libfuse-dev [linux-any kfreebsd-any] <!pkg.e2fsprogs.no-fuse2fs>, debhelper-compat (= 12), dh-exec, libblkid-dev, uuid-dev, m4, udev [linux-any], systemd [linux-any], cron [linux-any]
Rules-Requires-Root: no
-Standards-Version: 4.6.0
+Standards-Version: 4.6.1
Homepage: http://e2fsprogs.sourceforge.net
Vcs-Browser: https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
Vcs-Git: https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git -b debian/master
diff --git a/debugfs/debugfs.8.in b/debugfs/debugfs.8.in
index a3227a80..5b5329c3 100644
--- a/debugfs/debugfs.8.in
+++ b/debugfs/debugfs.8.in
@@ -280,7 +280,7 @@ The hash seed specified with
must be in UUID format.
.TP
.BI dump_extents " [-n] [-l] filespec"
-Dump the the extent tree of the inode
+Dump the extent tree of the inode
.IR filespec .
The
.I -n
diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index 78b93eda..9b6321dc 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -50,7 +50,7 @@ int journal_enable_debug = -1;
/*
* There must be only one definition if we're hooking in extra commands or
- * chaging default prompt. Use -DSKIP_GLOBDEF for that.
+ * changing default prompt. Use -DSKIP_GLOBDEF for that.
*/
#ifndef SKIP_GLOBDEFS
ss_request_table *extra_cmds;
diff --git a/doc/libext2fs.texinfo b/doc/libext2fs.texinfo
index 3043398d..970fca78 100644
--- a/doc/libext2fs.texinfo
+++ b/doc/libext2fs.texinfo
@@ -625,7 +625,7 @@ The @var{flags} parameter controls how the iterator will function:
@table @samp
@item BLOCK_FLAG_HOLE
-This flag indicates that the interator function should be called on
+This flag indicates that the iterator function should be called on
blocks where the block number is zero (also known as ``holes''.) It is
also known as BLOCK_FLAG_APPEND, since it is also used by functions
such as ext2fs_expand_dir() to add a new block to an inode.
@@ -1150,7 +1150,7 @@ utility programs.
@subsection Directory-block list management
The dblist abstraction stores a list of blocks belonging to
-directories. This list can be useful when a program needs to interate
+directories. This list can be useful when a program needs to iterate
over all directory entries in a filesystem; @code{e2fsck} does this in
pass 2 of its operations, and @code{debugfs} needs to do this when it is
trying to turn an inode number into a pathname.
diff --git a/doc/texinfo.tex b/doc/texinfo.tex
index dddd0140..dd526155 100644
--- a/doc/texinfo.tex
+++ b/doc/texinfo.tex
@@ -404,7 +404,7 @@
\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
-% Each occurence of `\^^M' or `<space>\^^M' is replaced by a single space.
+% Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
%
% \argremovec might leave us with trailing space, e.g.,
% @end itemize @c foo
@@ -430,7 +430,7 @@
% to get _exactly_ the rest of the line, we had to prevent such situation.
% We prepended an \empty token at the very beginning and we expand it now,
% just before passing the control to \next.
-% (Similarily, we have to think about #3 of \argcheckspacesY above: it is
+% (Similarly, we have to think about #3 of \argcheckspacesY above: it is
% either the null string, or it ends with \^^M---thus there is no danger
% that a pair of braces would be stripped.
%
@@ -487,7 +487,7 @@
% used to check whether the current environment is the one expected.
%
% Non-false conditionals (@iftex, @ifset) don't fit into this, so they
-% are not treated as enviroments; they don't open a group. (The
+% are not treated as environments; they don't open a group. (The
% implementation of @end takes care not to call \endgroup in this
% special case.)
@@ -510,7 +510,7 @@
\fi
}
-% Evironment mismatch, #1 expected:
+% Environment mismatch, #1 expected:
\def\badenverr{%
\errhelp = \EMsimple
\errmessage{This command can appear only \inenvironment\temp,
@@ -4045,7 +4045,7 @@ where each line of input produces a line of output.}
\chardef\maxseclevel = 3
%
% A numbered section within an unnumbered changes to unnumbered too.
-% To achive this, remember the "biggest" unnum. sec. we are currently in:
+% To achieve this, remember the "biggest" unnum. sec. we are currently in:
\chardef\unmlevel = \maxseclevel
%
% Trace whether the current chapter is an appendix or not:
@@ -6417,7 +6417,7 @@ where each line of input produces a line of output.}
% In case a @footnote appears in a vbox, save the footnote text and create
% the real \insert just after the vbox finished. Otherwise, the insertion
% would be lost.
-% Similarily, if a @footnote appears inside an alignment, save the footnote
+% Similarly, if a @footnote appears inside an alignment, save the footnote
% text to a box and make the \insert when a row of the table is finished.
% And the same can be done for other insert classes. --kasal, 16nov03.
diff --git a/e2fsck/dirinfo.c b/e2fsck/dirinfo.c
index 49d624c5..9873e385 100644
--- a/e2fsck/dirinfo.c
+++ b/e2fsck/dirinfo.c
@@ -376,7 +376,7 @@ void e2fsck_dir_info_iter_end(e2fsck_t ctx EXT2FS_ATTR((unused)),
}
/*
- * A simple interator function
+ * A simple iterator function
*/
struct dir_info *e2fsck_dir_info_iter(e2fsck_t ctx, struct dir_info_iter *iter)
{
diff --git a/e2fsck/dx_dirinfo.c b/e2fsck/dx_dirinfo.c
index caca3e30..4b764b0f 100644
--- a/e2fsck/dx_dirinfo.c
+++ b/e2fsck/dx_dirinfo.c
@@ -143,7 +143,7 @@ ext2_ino_t e2fsck_get_num_dx_dirinfo(e2fsck_t ctx)
}
/*
- * A simple interator function
+ * A simple iterator function
*/
struct dx_dir_info *e2fsck_dx_dir_info_iter(e2fsck_t ctx, ext2_ino_t *control)
{
diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h
index 252a17db..3f2dc308 100644
--- a/e2fsck/e2fsck.h
+++ b/e2fsck/e2fsck.h
@@ -236,7 +236,7 @@ typedef struct e2fsck_struct *e2fsck_t;
#define MAX_EXTENT_DEPTH_COUNT 8
/*
- * This strucutre is used to manage the list of extents in a file. Placing
+ * This structure is used to manage the list of extents in a file. Placing
* it here since this is used by fast_commit.h.
*/
struct extent_list {
diff --git a/e2fsck/jfs_user.h b/e2fsck/jfs_user.h
index 969cd1b9..1167c80d 100644
--- a/e2fsck/jfs_user.h
+++ b/e2fsck/jfs_user.h
@@ -82,16 +82,9 @@ struct kdev_s {
#define buffer_req(bh) 1
#define do_readahead(journal, start) do {} while (0)
-typedef struct kmem_cache {
- int object_length;
-} kmem_cache_t;
-
-#define kmem_cache_alloc(cache, flags) malloc((cache)->object_length)
-#define kmem_cache_free(cache, obj) free(obj)
-#define kmem_cache_create(name, len, a, b, c) do_cache_create(len)
-#define kmem_cache_destroy(cache) do_cache_destroy(cache)
-#define kmalloc(len, flags) malloc(len)
-#define kfree(p) free(p)
+struct kmem_cache {
+ unsigned int object_size;
+};
#define cond_resched() do { } while (0)
@@ -107,8 +100,16 @@ typedef struct kmem_cache {
* functions.
*/
#ifdef NO_INLINE_FUNCS
-extern kmem_cache_t *do_cache_create(int len);
-extern void do_cache_destroy(kmem_cache_t *cache);
+extern struct kmem_cache *kmem_cache_create(const char *name,
+ unsigned int size,
+ unsigned int align,
+ unsigned int flags,
+ void (*ctor)(void *));
+extern void kmem_cache_destroy(struct kmem_cache *s);
+extern void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags);
+extern void kmem_cache_free(struct kmem_cache *s, void *objp);
+extern void *kmalloc(size_t size, gfp_t flags);
+extern void kfree(const void *objp);
extern size_t journal_tag_bytes(journal_t *journal);
extern __u32 __hash_32(__u32 val);
extern __u32 hash_32(__u32 val, unsigned int bits);
@@ -139,19 +140,46 @@ extern void jbd2_descriptor_block_csum_set(journal_t *j,
#endif /* __STDC_VERSION__ >= 199901L */
#endif /* E2FSCK_INCLUDE_INLINE_FUNCS */
-_INLINE_ kmem_cache_t *do_cache_create(int len)
+_INLINE_ struct kmem_cache *
+kmem_cache_create(const char *name EXT2FS_ATTR((unused)),
+ unsigned int size,
+ unsigned int align EXT2FS_ATTR((unused)),
+ unsigned int flags EXT2FS_ATTR((unused)),
+ void (*ctor)(void *) EXT2FS_ATTR((unused)))
{
- kmem_cache_t *new_cache;
+ struct kmem_cache *new_cache;
new_cache = malloc(sizeof(*new_cache));
if (new_cache)
- new_cache->object_length = len;
+ new_cache->object_size = size;
return new_cache;
}
-_INLINE_ void do_cache_destroy(kmem_cache_t *cache)
+_INLINE_ void kmem_cache_destroy(struct kmem_cache *s)
+{
+ free(s);
+}
+
+_INLINE_ void *kmem_cache_alloc(struct kmem_cache *cachep,
+ gfp_t flags EXT2FS_ATTR((unused)))
+{
+ return malloc(cachep->object_size);
+}
+
+_INLINE_ void kmem_cache_free(struct kmem_cache *s EXT2FS_ATTR((unused)),
+ void *objp)
+{
+ free(objp);
+}
+
+_INLINE_ void *kmalloc(size_t size, gfp_t flags EXT2FS_ATTR((unused)))
+{
+ return malloc(size);
+}
+
+_INLINE_ void kfree(const void *objp)
{
- free(cache);
+ free((void *)objp);
}
/* generic hashing taken from the Linux kernel */
diff --git a/e2fsck/journal.c b/e2fsck/journal.c
index d802c5e9..c7868d89 100644
--- a/e2fsck/journal.c
+++ b/e2fsck/journal.c
@@ -888,7 +888,7 @@ static int ext4_fc_replay(journal_t *journal, struct buffer_head *bh,
/*
* Mark the file system to indicate it contains errors. That's
* because the updates performed by fast commit replay code are
- * not atomic and may result in incosistent file system if it
+ * not atomic and may result in inconsistent file system if it
* crashes before the replay is complete.
*/
ctx->fs->super->s_state |= EXT2_ERROR_FS;
@@ -1039,7 +1039,8 @@ static errcode_t e2fsck_get_journal(e2fsck_t ctx, journal_t **ret_journal)
tried_backup_jnl++;
}
if (!j_inode->i_ext2.i_links_count ||
- !LINUX_S_ISREG(j_inode->i_ext2.i_mode)) {
+ !LINUX_S_ISREG(j_inode->i_ext2.i_mode) ||
+ (j_inode->i_ext2.i_flags & EXT4_ENCRYPT_FL)) {
retval = EXT2_ET_NO_JOURNAL;
goto try_backup_journal;
}
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 73909c39..591acad5 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -1331,7 +1331,7 @@ void e2fsck_pass1(e2fsck_t ctx)
goto endit;
}
block_buf = (char *) e2fsck_allocate_memory(ctx, fs->blocksize * 3,
- "block interate buffer");
+ "block iterate buffer");
if (EXT2_INODE_SIZE(fs->super) == EXT2_GOOD_OLD_INODE_SIZE)
e2fsck_use_inode_shortcuts(ctx, 1);
e2fsck_intercept_block_allocations(ctx);
diff --git a/e2fsck/pass1b.c b/e2fsck/pass1b.c
index 92c746c1..950af5be 100644
--- a/e2fsck/pass1b.c
+++ b/e2fsck/pass1b.c
@@ -90,7 +90,7 @@ static void delete_file(e2fsck_t ctx, ext2_ino_t ino,
struct dup_inode *dp, char *block_buf);
static errcode_t clone_file(e2fsck_t ctx, ext2_ino_t ino,
struct dup_inode *dp, char* block_buf);
-static int check_if_fs_block(e2fsck_t ctx, blk64_t test_block);
+static int check_if_fs_block(e2fsck_t ctx, blk64_t block);
static int check_if_fs_cluster(e2fsck_t ctx, blk64_t cluster);
static void pass1b(e2fsck_t ctx, char *block_buf);
@@ -815,8 +815,6 @@ static int clone_file_block(ext2_filsys fs,
should_write = 0;
c = EXT2FS_B2C(fs, blockcnt);
- if (check_if_fs_cluster(ctx, EXT2FS_B2C(fs, *block_nr)))
- is_meta = 1;
if (c == cs->dup_cluster && cs->alloc_block) {
new_block = cs->alloc_block;
@@ -894,6 +892,8 @@ cluster_alloc_ok:
return BLOCK_ABORT;
}
}
+ if (check_if_fs_cluster(ctx, EXT2FS_B2C(fs, *block_nr)))
+ is_meta = 1;
cs->save_dup_cluster = (is_meta ? NULL : p);
cs->save_blocknr = *block_nr;
*block_nr = new_block;
@@ -1021,37 +1021,9 @@ errout:
* This routine returns 1 if a block overlaps with one of the superblocks,
* group descriptors, inode bitmaps, or block bitmaps.
*/
-static int check_if_fs_block(e2fsck_t ctx, blk64_t test_block)
+static int check_if_fs_block(e2fsck_t ctx, blk64_t block)
{
- ext2_filsys fs = ctx->fs;
- blk64_t first_block;
- dgrp_t i;
-
- first_block = fs->super->s_first_data_block;
- for (i = 0; i < fs->group_desc_count; i++) {
-
- /* Check superblocks/block group descriptors */
- if (ext2fs_bg_has_super(fs, i)) {
- if (test_block >= first_block &&
- (test_block <= first_block + fs->desc_blocks))
- return 1;
- }
-
- /* Check the inode table */
- if ((ext2fs_inode_table_loc(fs, i)) &&
- (test_block >= ext2fs_inode_table_loc(fs, i)) &&
- (test_block < (ext2fs_inode_table_loc(fs, i) +
- fs->inode_blocks_per_group)))
- return 1;
-
- /* Check the bitmap blocks */
- if ((test_block == ext2fs_block_bitmap_loc(fs, i)) ||
- (test_block == ext2fs_inode_bitmap_loc(fs, i)))
- return 1;
-
- first_block += fs->super->s_blocks_per_group;
- }
- return 0;
+ return ext2fs_test_block_bitmap2(ctx->block_metadata_map, block);
}
/*
@@ -1061,37 +1033,14 @@ static int check_if_fs_block(e2fsck_t ctx, blk64_t test_block)
static int check_if_fs_cluster(e2fsck_t ctx, blk64_t cluster)
{
ext2_filsys fs = ctx->fs;
- blk64_t first_block;
- dgrp_t i;
-
- first_block = fs->super->s_first_data_block;
- for (i = 0; i < fs->group_desc_count; i++) {
-
- /* Check superblocks/block group descriptors */
- if (ext2fs_bg_has_super(fs, i)) {
- if (cluster >= EXT2FS_B2C(fs, first_block) &&
- (cluster <= EXT2FS_B2C(fs, first_block +
- fs->desc_blocks)))
- return 1;
- }
+ blk64_t block = EXT2FS_C2B(fs, cluster);
+ int i;
- /* Check the inode table */
- if ((ext2fs_inode_table_loc(fs, i)) &&
- (cluster >= EXT2FS_B2C(fs,
- ext2fs_inode_table_loc(fs, i))) &&
- (cluster <= EXT2FS_B2C(fs,
- ext2fs_inode_table_loc(fs, i) +
- fs->inode_blocks_per_group - 1)))
+ for (i = 0; i < EXT2FS_CLUSTER_RATIO(fs); i++) {
+ if (ext2fs_test_block_bitmap2(ctx->block_metadata_map,
+ block + i))
return 1;
-
- /* Check the bitmap blocks */
- if ((cluster == EXT2FS_B2C(fs,
- ext2fs_block_bitmap_loc(fs, i))) ||
- (cluster == EXT2FS_B2C(fs,
- ext2fs_inode_bitmap_loc(fs, i))))
- return 1;
-
- first_block += fs->super->s_blocks_per_group;
}
+
return 0;
}
diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c
index bc6ffa18..410edd11 100644
--- a/e2fsck/pass2.c
+++ b/e2fsck/pass2.c
@@ -1812,7 +1812,7 @@ struct del_block {
};
/*
- * This function is called to deallocate a block, and is an interator
+ * This function is called to deallocate a block, and is an iterator
* functioned called by deallocate inode via ext2fs_iterate_block().
*/
static int deallocate_inode_block(ext2_filsys fs,
diff --git a/e2fsck/rehash.c b/e2fsck/rehash.c
index f7b19f62..c1da7d52 100644
--- a/e2fsck/rehash.c
+++ b/e2fsck/rehash.c
@@ -1053,13 +1053,11 @@ retry_nohash:
/* Sort the list */
resort:
if (fd.compress && fd.num_array > 1)
- sort_r_simple(fd.harray+2, fd.num_array-2,
- sizeof(struct hash_entry),
- hash_cmp, &name_cmp_ctx);
+ sort_r(fd.harray+2, fd.num_array-2, sizeof(struct hash_entry),
+ hash_cmp, &name_cmp_ctx);
else
- sort_r_simple(fd.harray, fd.num_array,
- sizeof(struct hash_entry),
- hash_cmp, &name_cmp_ctx);
+ sort_r(fd.harray, fd.num_array, sizeof(struct hash_entry),
+ hash_cmp, &name_cmp_ctx);
/*
* Look for duplicates
diff --git a/ext2ed/doc/ext2ed-design.sgml b/ext2ed/doc/ext2ed-design.sgml
index e8052a90..b2cab37e 100644
--- a/ext2ed/doc/ext2ed-design.sgml
+++ b/ext2ed/doc/ext2ed-design.sgml
@@ -1446,7 +1446,7 @@ specific commands, by using <Literal remap="tt">free&lowbar;struct&lowbar;descri
<ListItem>
<Para>
- Closes the window subsystem, and deattaches EXT2ED from the ncurses
+ Closes the window subsystem, and detaches EXT2ED from the ncurses
library, through the use of the <Literal remap="tt">close&lowbar;windows</Literal> function,
available in <Literal remap="tt">win.c</Literal>.
</Para>
diff --git a/include/mingw/arpa/inet.h b/include/mingw/arpa/inet.h
new file mode 100644
index 00000000..55dfa369
--- /dev/null
+++ b/include/mingw/arpa/inet.h
@@ -0,0 +1,5 @@
+#pragma once
+
+/* Windows is always little endian. */
+#define htonl __builtin_bswap32
+#define ntohl __builtin_bswap32
diff --git a/include/mingw/sys/sysmacros.h b/include/mingw/sys/sysmacros.h
index 18fcaaa3..a790cb2f 100644
--- a/include/mingw/sys/sysmacros.h
+++ b/include/mingw/sys/sysmacros.h
@@ -1,11 +1,5 @@
-
#pragma once
-/*
- * Fall back to Linux's definitions of makedev and major are needed.
- * The search_sysfs_block() function is highly unlikely to work on
- * non-Linux systems anyway.
- */
#ifndef makedev
#define makedev(maj, min) (((maj) << 8) + (min))
-#endif \ No newline at end of file
+#endif
diff --git a/lib/blkid/Android.bp b/lib/blkid/Android.bp
index a4011319..f5d25da4 100644
--- a/lib/blkid/Android.bp
+++ b/lib/blkid/Android.bp
@@ -42,7 +42,6 @@ cc_library {
include_dirs: ["external/e2fsprogs/include/mingw"],
cflags: [
"-Wno-pointer-to-int-cast",
- "-Wno-unused-variable",
"-Wno-error=typedef-redefinition",
],
diff --git a/lib/blkid/devno.c b/lib/blkid/devno.c
index 34ceb3c4..b1cadc9d 100644
--- a/lib/blkid/devno.c
+++ b/lib/blkid/devno.c
@@ -37,6 +37,12 @@
#include "blkidP.h"
+#if defined(__GNUC__) && __GNUC__ >= 8
+/* gcc incorrectly thinks the destination string is not being null-terminated */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
+#endif
+
char *blkid_strndup(const char *s, int length)
{
char *ret;
@@ -55,6 +61,10 @@ char *blkid_strndup(const char *s, int length)
return ret;
}
+#if defined(__GNUC__) && __GNUC__ >= 8
+#pragma GCC diagnostic pop
+#endif
+
char *blkid_strdup(const char *s)
{
return blkid_strndup(s, 0);
diff --git a/lib/blkid/getsize.c b/lib/blkid/getsize.c
index 75f21d5c..7a6e6fd8 100644
--- a/lib/blkid/getsize.c
+++ b/lib/blkid/getsize.c
@@ -75,7 +75,7 @@ static int valid_offset(int fd, blkid_loff_t offset)
*/
blkid_loff_t blkid_get_dev_size(int fd)
{
- unsigned long long size64;
+ unsigned long long size64 __BLKID_ATTR((unused));
blkid_loff_t high, low;
#if defined DKIOCGETBLOCKCOUNT && defined DKIOCGETBLOCKSIZE /* For Apple Darwin */
diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c
index b8b6558e..6a3bb247 100644
--- a/lib/blkid/probe.c
+++ b/lib/blkid/probe.c
@@ -1198,7 +1198,6 @@ static int probe_hfs(struct blkid_probe *probe __BLKID_ATTR((unused)),
unsigned char *buf)
{
struct hfs_mdb *hfs = (struct hfs_mdb *)buf;
- unsigned long long *uuid_ptr;
char uuid_str[17];
__u64 uuid;
@@ -1206,8 +1205,8 @@ static int probe_hfs(struct blkid_probe *probe __BLKID_ATTR((unused)),
(memcmp(hfs->embed_sig, "HX", 2) == 0))
return 1; /* Not hfs, but an embedded HFS+ */
- uuid_ptr = (unsigned long long *)hfs->finder_info.id;
- uuid = blkid_le64(*uuid_ptr);
+ memcpy(&uuid, hfs->finder_info.id, 8);
+ uuid = blkid_le64(uuid);
if (uuid) {
sprintf(uuid_str, "%016llX", uuid);
blkid_set_tag(probe->dev, "UUID", uuid_str, 0);
@@ -1243,7 +1242,6 @@ static int probe_hfsplus(struct blkid_probe *probe,
unsigned int leaf_node_size;
unsigned int leaf_block;
unsigned int label_len;
- unsigned long long *uuid_ptr;
__u64 leaf_off, uuid;
char uuid_str[17], label[512];
int ext;
@@ -1274,8 +1272,8 @@ static int probe_hfsplus(struct blkid_probe *probe,
(memcmp(hfsplus->signature, "HX", 2) != 0))
return 1;
- uuid_ptr = (unsigned long long *)hfsplus->finder_info.id;
- uuid = blkid_le64(*uuid_ptr);
+ memcpy(&uuid, hfsplus->finder_info.id, 8);
+ uuid = blkid_le64(uuid);
if (uuid) {
sprintf(uuid_str, "%016llX", uuid);
blkid_set_tag(probe->dev, "UUID", uuid_str, 0);
diff --git a/lib/blkid/probe.h b/lib/blkid/probe.h
index dea4081d..063a5b5c 100644
--- a/lib/blkid/probe.h
+++ b/lib/blkid/probe.h
@@ -814,46 +814,6 @@ struct exfat_entry_label {
#define _INLINE_ static inline
#endif
-static __u16 blkid_swab16(__u16 val);
-static __u32 blkid_swab32(__u32 val);
-static __u64 blkid_swab64(__u64 val);
-
-#if ((defined __GNUC__) && \
- (defined(__i386__) || defined(__i486__) || defined(__i586__)))
-
-#define _BLKID_HAVE_ASM_BITOPS_
-
-_INLINE_ __u32 blkid_swab32(__u32 val)
-{
-#ifdef EXT2FS_REQUIRE_486
- __asm__("bswap %0" : "=r" (val) : "0" (val));
-#else
- __asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */
- "rorl $16,%0\n\t" /* swap words */
- "xchgb %b0,%h0" /* swap higher bytes */
- :"=q" (val)
- : "0" (val));
-#endif
- return val;
-}
-
-_INLINE_ __u16 blkid_swab16(__u16 val)
-{
- __asm__("xchgb %b0,%h0" /* swap bytes */ \
- : "=q" (val) \
- : "0" (val)); \
- return val;
-}
-
-_INLINE_ __u64 blkid_swab64(__u64 val)
-{
- return (blkid_swab32(val >> 32) |
- (((__u64) blkid_swab32(val & 0xFFFFFFFFUL)) << 32));
-}
-#endif
-
-#if !defined(_BLKID_HAVE_ASM_BITOPS_)
-
_INLINE_ __u16 blkid_swab16(__u16 val)
{
return (val >> 8) | (val << 8);
@@ -870,9 +830,6 @@ _INLINE_ __u64 blkid_swab64(__u64 val)
return (blkid_swab32(val >> 32) |
(((__u64) blkid_swab32(val & 0xFFFFFFFFUL)) << 32));
}
-#endif
-
-
#ifdef WORDS_BIGENDIAN
#define blkid_le16(x) blkid_swab16(x)
diff --git a/lib/blkid/save.c b/lib/blkid/save.c
index 036f07a4..6f4499cf 100644
--- a/lib/blkid/save.c
+++ b/lib/blkid/save.c
@@ -154,7 +154,15 @@ int blkid_flush_cache(blkid_cache cache)
if (backup) {
sprintf(backup, "%s.old", filename);
unlink(backup);
+#if defined(__GNUC__) && __GNUC__ >= 5
+/* explicit (void) cast is not enough with glibc and _FORTIFY_SOURCE */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-result"
+#endif
(void) link(filename, backup);
+#if defined(__GNUC__) && __GNUC__ >= 5
+#pragma GCC diagnostic pop
+#endif
free(backup);
}
if (rename(opened, filename) < 0)
diff --git a/lib/config.h.in b/lib/config.h.in
index b5856bb5..6cf1f47d 100644
--- a/lib/config.h.in
+++ b/lib/config.h.in
@@ -55,6 +55,9 @@
/* Define to 1 if blkid has blkid_topology_get_dax */
#undef HAVE_BLKID_TOPOLOGY_GET_DAX
+/* Define to 1 if you have the BSD-style 'qsort_r' function. */
+#undef HAVE_BSD_QSORT_R
+
/* Define to 1 if you have the Mac OS X function
CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */
#undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES
@@ -154,6 +157,9 @@
/* Define if the GNU gettext() function is already present or preinstalled. */
#undef HAVE_GETTEXT
+/* Define to 1 if you have the GNU-style 'qsort_r' function. */
+#undef HAVE_GNU_QSORT_R
+
/* Define if you have the iconv() function and it works. */
#undef HAVE_ICONV
@@ -220,12 +226,12 @@
/* Define to 1 if you have the `memalign' function. */
#undef HAVE_MEMALIGN
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
/* Define to 1 if you have the `mempcpy' function. */
#undef HAVE_MEMPCPY
+/* Define to 1 if you have the <minix/config.h> header file. */
+#undef HAVE_MINIX_CONFIG_H
+
/* Define to 1 if you have the `mmap' function. */
#undef HAVE_MMAP
@@ -298,6 +304,9 @@
/* Define to 1 if you have the `pwrite64' function. */
#undef HAVE_PWRITE64
+/* Define to 1 if you have the `qsort_r' function. */
+#undef HAVE_QSORT_R
+
/* Define to 1 if dirent has d_reclen */
#undef HAVE_RECLEN_DIRENT
@@ -343,6 +352,9 @@
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
+/* Define to 1 if you have the <stdio.h> header file. */
+#undef HAVE_STDIO_H
+
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
@@ -478,6 +490,9 @@
/* Define to 1 if you have the `vprintf' function. */
#undef HAVE_VPRINTF
+/* Define to 1 if you have the <wchar.h> header file. */
+#undef HAVE_WCHAR_H
+
/* Define to 1 if you have the `__secure_getenv' function. */
#undef HAVE___SECURE_GETENV
@@ -524,7 +539,9 @@
/* The size of `time_t', as computed by sizeof. */
#undef SIZEOF_TIME_T
-/* Define to 1 if you have the ANSI C header files. */
+/* Define to 1 if all of the C90 standard headers exist (not just the ones
+ required in a freestanding environment). This macro is provided for
+ backward compatibility; new code need not use it. */
#undef STDC_HEADERS
/* If the compiler supports a TLS storage class define it to that here */
@@ -534,21 +551,87 @@
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
+/* Enable general extensions on macOS. */
+#ifndef _DARWIN_C_SOURCE
+# undef _DARWIN_C_SOURCE
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
-/* Enable threading extensions on Solaris. */
+/* Enable X/Open compliant socket functions that do not require linking
+ with -lxnet on HP-UX 11.11. */
+#ifndef _HPUX_ALT_XOPEN_SOCKET_API
+# undef _HPUX_ALT_XOPEN_SOCKET_API
+#endif
+/* Identify the host operating system as Minix.
+ This macro does not affect the system headers' behavior.
+ A future release of Autoconf may stop defining this macro. */
+#ifndef _MINIX
+# undef _MINIX
+#endif
+/* Enable general extensions on NetBSD.
+ Enable NetBSD compatibility extensions on Minix. */
+#ifndef _NETBSD_SOURCE
+# undef _NETBSD_SOURCE
+#endif
+/* Enable OpenBSD compatibility extensions on NetBSD.
+ Oddly enough, this does nothing on OpenBSD. */
+#ifndef _OPENBSD_SOURCE
+# undef _OPENBSD_SOURCE
+#endif
+/* Define to 1 if needed for POSIX-compatible behavior. */
+#ifndef _POSIX_SOURCE
+# undef _POSIX_SOURCE
+#endif
+/* Define to 2 if needed for POSIX-compatible behavior. */
+#ifndef _POSIX_1_SOURCE
+# undef _POSIX_1_SOURCE
+#endif
+/* Enable POSIX-compatible threading on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
+/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */
+#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
+# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */
+#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
+# undef __STDC_WANT_IEC_60559_BFP_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */
+#ifndef __STDC_WANT_IEC_60559_DFP_EXT__
+# undef __STDC_WANT_IEC_60559_DFP_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */
+#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
+# undef __STDC_WANT_IEC_60559_FUNCS_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */
+#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
+# undef __STDC_WANT_IEC_60559_TYPES_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */
+#ifndef __STDC_WANT_LIB_EXT2__
+# undef __STDC_WANT_LIB_EXT2__
+#endif
+/* Enable extensions specified by ISO/IEC 24747:2009. */
+#ifndef __STDC_WANT_MATH_SPEC_FUNCS__
+# undef __STDC_WANT_MATH_SPEC_FUNCS__
+#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
-/* Enable general extensions on Solaris. */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
+/* Enable X/Open extensions. Define to 500 only if necessary
+ to make mbstate_t available. */
+#ifndef _XOPEN_SOURCE
+# undef _XOPEN_SOURCE
#endif
@@ -573,14 +656,4 @@
/* Define to 1 if Apple Darwin libintl workaround is needed */
#undef _INTL_REDIRECT_MACROS
-/* Define to 1 if on MINIX. */
-#undef _MINIX
-
-/* Define to 2 if the system does not provide POSIX.1 features except with
- this defined. */
-#undef _POSIX_1_SOURCE
-
-/* Define to 1 if you need to in order for `stat' and other things to work. */
-#undef _POSIX_SOURCE
-
#include <dirpaths.h>
diff --git a/lib/e2p/Android.bp b/lib/e2p/Android.bp
index 6f0620af..050d869b 100644
--- a/lib/e2p/Android.bp
+++ b/lib/e2p/Android.bp
@@ -59,10 +59,6 @@ cc_library {
"-Wno-unused-variable",
"-Wno-error=typedef-redefinition",
],
-
- host_ldlibs: [
- "-lws2_32",
- ],
},
},
diff --git a/lib/e2p/fgetversion.c b/lib/e2p/fgetversion.c
index a65e9a5c..f3a5b4cd 100644
--- a/lib/e2p/fgetversion.c
+++ b/lib/e2p/fgetversion.c
@@ -65,8 +65,6 @@ int fgetversion(const char *name, unsigned long *version)
rc = syscall(SYS_fsctl, name, EXT2_IOC_GETVERSION, &ver, 0);
# endif /* !APPLE_DARWIN */
#else /* ! HAVE_EXT2_IOCTLS */
- extern int errno;
-
errno = EOPNOTSUPP;
#endif /* ! HAVE_EXT2_IOCTLS */
if (rc == 0)
diff --git a/lib/e2p/fsetversion.c b/lib/e2p/fsetversion.c
index c2e04559..5f844b55 100644
--- a/lib/e2p/fsetversion.c
+++ b/lib/e2p/fsetversion.c
@@ -65,7 +65,6 @@ int fsetversion (const char * name, unsigned long version)
return syscall(SYS_fsctl, name, EXT2_IOC_SETVERSION, &ver, 0);
#endif
#else /* ! HAVE_EXT2_IOCTLS */
- extern int errno;
errno = EOPNOTSUPP;
return -1;
#endif /* ! HAVE_EXT2_IOCTLS */
diff --git a/lib/e2p/getflags.c b/lib/e2p/getflags.c
index e4e2ad73..6708cd68 100644
--- a/lib/e2p/getflags.c
+++ b/lib/e2p/getflags.c
@@ -30,8 +30,8 @@
int getflags (int fd, unsigned long * flags)
{
- struct stat buf;
#if HAVE_STAT_FLAGS
+ struct stat buf;
if (fstat (fd, &buf) == -1)
return -1;
@@ -53,6 +53,7 @@ int getflags (int fd, unsigned long * flags)
return 0;
#else
#if HAVE_EXT2_IOCTLS
+ struct stat buf;
int r, f;
if (!fstat(fd, &buf) &&
diff --git a/lib/e2p/getversion.c b/lib/e2p/getversion.c
index 9f719b4a..d374a0ea 100644
--- a/lib/e2p/getversion.c
+++ b/lib/e2p/getversion.c
@@ -35,7 +35,6 @@ int getversion (int fd, unsigned long * version)
*version = ver;
return r;
#else /* ! HAVE_EXT2_IOCTLS */
- extern int errno;
errno = EOPNOTSUPP;
return -1;
#endif /* ! HAVE_EXT2_IOCTLS */
diff --git a/lib/e2p/setversion.c b/lib/e2p/setversion.c
index 2bc93374..dd4a3f06 100644
--- a/lib/e2p/setversion.c
+++ b/lib/e2p/setversion.c
@@ -34,7 +34,6 @@ int setversion (int fd, unsigned long version)
ver = (int) version;
return ioctl (fd, EXT2_IOC_SETVERSION, &ver);
#else /* ! HAVE_EXT2_IOCTLS */
- extern int errno;
errno = EOPNOTSUPP;
return -1;
#endif /* ! HAVE_EXT2_IOCTLS */
diff --git a/lib/et/Android.bp b/lib/et/Android.bp
index 07f3c277..565feb59 100644
--- a/lib/et/Android.bp
+++ b/lib/et/Android.bp
@@ -31,9 +31,6 @@ cc_library {
target: {
windows: {
enabled: true,
- cflags: [
- "-Wno-unused-variable",
- ],
},
},
diff --git a/lib/et/error_message.c b/lib/et/error_message.c
index cd9f57f5..8b9474ff 100644
--- a/lib/et/error_message.c
+++ b/lib/et/error_message.c
@@ -235,7 +235,6 @@ static FILE *debug_f = 0;
static void init_debug(void)
{
char *dstr, *fn, *tmp;
- int fd, flags;
if (debug_mask & DEBUG_INIT)
return;
@@ -257,10 +256,12 @@ static void init_debug(void)
if (!debug_f)
debug_f = fopen("/dev/tty", "a");
if (debug_f) {
- fd = fileno(debug_f);
-#if defined(HAVE_FCNTL)
+#ifdef HAVE_FCNTL
+ int fd = fileno(debug_f);
+
if (fd >= 0) {
- flags = fcntl(fd, F_GETFD);
+ int flags = fcntl(fd, F_GETFD);
+
if (flags >= 0)
flags = fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
if (flags < 0) {
@@ -274,7 +275,6 @@ static void init_debug(void)
#endif
} else
debug_mask = DEBUG_INIT;
-
}
/*
diff --git a/lib/et/texinfo.tex b/lib/et/texinfo.tex
index dddd0140..dd526155 100644
--- a/lib/et/texinfo.tex
+++ b/lib/et/texinfo.tex
@@ -404,7 +404,7 @@
\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
-% Each occurence of `\^^M' or `<space>\^^M' is replaced by a single space.
+% Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
%
% \argremovec might leave us with trailing space, e.g.,
% @end itemize @c foo
@@ -430,7 +430,7 @@
% to get _exactly_ the rest of the line, we had to prevent such situation.
% We prepended an \empty token at the very beginning and we expand it now,
% just before passing the control to \next.
-% (Similarily, we have to think about #3 of \argcheckspacesY above: it is
+% (Similarly, we have to think about #3 of \argcheckspacesY above: it is
% either the null string, or it ends with \^^M---thus there is no danger
% that a pair of braces would be stripped.
%
@@ -487,7 +487,7 @@
% used to check whether the current environment is the one expected.
%
% Non-false conditionals (@iftex, @ifset) don't fit into this, so they
-% are not treated as enviroments; they don't open a group. (The
+% are not treated as environments; they don't open a group. (The
% implementation of @end takes care not to call \endgroup in this
% special case.)
@@ -510,7 +510,7 @@
\fi
}
-% Evironment mismatch, #1 expected:
+% Environment mismatch, #1 expected:
\def\badenverr{%
\errhelp = \EMsimple
\errmessage{This command can appear only \inenvironment\temp,
@@ -4045,7 +4045,7 @@ where each line of input produces a line of output.}
\chardef\maxseclevel = 3
%
% A numbered section within an unnumbered changes to unnumbered too.
-% To achive this, remember the "biggest" unnum. sec. we are currently in:
+% To achieve this, remember the "biggest" unnum. sec. we are currently in:
\chardef\unmlevel = \maxseclevel
%
% Trace whether the current chapter is an appendix or not:
@@ -6417,7 +6417,7 @@ where each line of input produces a line of output.}
% In case a @footnote appears in a vbox, save the footnote text and create
% the real \insert just after the vbox finished. Otherwise, the insertion
% would be lost.
-% Similarily, if a @footnote appears inside an alignment, save the footnote
+% Similarly, if a @footnote appears inside an alignment, save the footnote
% text to a box and make the \insert when a row of the table is finished.
% And the same can be done for other insert classes. --kasal, 16nov03.
diff --git a/lib/ext2fs/Android.bp b/lib/ext2fs/Android.bp
index 365ca709..eb4482d7 100644
--- a/lib/ext2fs/Android.bp
+++ b/lib/ext2fs/Android.bp
@@ -126,8 +126,6 @@ cc_library {
"-Wno-unused-variable",
"-Wno-error=typedef-redefinition",
],
-
- host_ldlibs: ["-lws2_32"],
},
},
diff --git a/lib/ext2fs/bitops.c b/lib/ext2fs/bitops.c
index c4a1d4e0..ce2acc46 100644
--- a/lib/ext2fs/bitops.c
+++ b/lib/ext2fs/bitops.c
@@ -19,14 +19,8 @@
#include "ext2_fs.h"
#include "ext2fs.h"
-#ifndef _EXT2_HAVE_ASM_BITOPS_
-
/*
- * For the benefit of those who are trying to port Linux to another
- * architecture, here are some C-language equivalents. You should
- * recode these in the native assembly language, if at all possible.
- *
- * C language equivalents written by Theodore Ts'o, 9/26/92.
+ * C language bitmap functions written by Theodore Ts'o, 9/26/92.
* Modified by Pete A. Zaitcev 7/14/95 to be portable to big endian
* systems, as well as non-32 bit systems.
*/
@@ -65,8 +59,6 @@ int ext2fs_test_bit(unsigned int nr, const void * addr)
return (mask & *ADDR);
}
-#endif /* !_EXT2_HAVE_ASM_BITOPS_ */
-
void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg,
const char *description)
{
@@ -78,9 +70,7 @@ void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg,
#endif
}
-/*
- * C-only 64 bit ops.
- */
+/* Bitmap functions that take a 64-bit offset */
int ext2fs_set_bit64(__u64 nr, void * addr)
{
diff --git a/lib/ext2fs/bitops.h b/lib/ext2fs/bitops.h
index 505b3c9c..9edf5944 100644
--- a/lib/ext2fs/bitops.h
+++ b/lib/ext2fs/bitops.h
@@ -219,14 +219,6 @@ extern errcode_t ext2fs_find_first_set_generic_bmap(ext2fs_generic_bitmap bitmap
* functions at all; they will be included as normal functions in
* inline.c
*/
-#ifdef NO_INLINE_FUNCS
-#if (defined(__GNUC__) && (defined(__i386__) || defined(__i486__) || \
- defined(__i586__)))
- /* This prevents bitops.c from trying to include the C */
- /* function version of these functions */
-#define _EXT2_HAVE_ASM_BITOPS_
-#endif
-#endif /* NO_INLINE_FUNCS */
#if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
#ifdef INCLUDE_INLINE_FUNCS
@@ -285,90 +277,6 @@ _INLINE_ void ext2fs_fast_clear_bit64(__u64 nr, void * addr)
*ADDR &= (unsigned char) ~(1 << (nr & 0x07));
}
-
-#if ((defined __GNUC__) && !defined(_EXT2_USE_C_VERSIONS_) && \
- (defined(__i386__) || defined(__i486__) || defined(__i586__)))
-
-#define _EXT2_HAVE_ASM_BITOPS_
-#define _EXT2_HAVE_ASM_SWAB_
-
-/*
- * These are done by inline assembly for speed reasons.....
- *
- * All bitoperations return 0 if the bit was cleared before the
- * operation and != 0 if it was not. Bit 0 is the LSB of addr; bit 32
- * is the LSB of (addr+1).
- */
-
-/*
- * Some hacks to defeat gcc over-optimizations..
- */
-struct __dummy_h { unsigned long a[100]; };
-#define EXT2FS_ADDR (*(struct __dummy_h *) addr)
-#define EXT2FS_CONST_ADDR (*(const struct __dummy_h *) addr)
-
-_INLINE_ int ext2fs_set_bit(unsigned int nr, void * addr)
-{
- int oldbit;
-
- addr = (void *) (((unsigned char *) addr) + (nr >> 3));
- __asm__ __volatile__("btsl %2,%1\n\tsbbl %0,%0"
- :"=r" (oldbit),"+m" (EXT2FS_ADDR)
- :"r" (nr & 7));
- return oldbit;
-}
-
-_INLINE_ int ext2fs_clear_bit(unsigned int nr, void * addr)
-{
- int oldbit;
-
- addr = (void *) (((unsigned char *) addr) + (nr >> 3));
- __asm__ __volatile__("btrl %2,%1\n\tsbbl %0,%0"
- :"=r" (oldbit),"+m" (EXT2FS_ADDR)
- :"r" (nr & 7));
- return oldbit;
-}
-
-_INLINE_ int ext2fs_test_bit(unsigned int nr, const void * addr)
-{
- int oldbit;
-
- addr = (const void *) (((const unsigned char *) addr) + (nr >> 3));
- __asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0"
- :"=r" (oldbit)
- :"m" (EXT2FS_CONST_ADDR),"r" (nr & 7));
- return oldbit;
-}
-
-_INLINE_ __u32 ext2fs_swab32(__u32 val)
-{
-#ifdef EXT2FS_REQUIRE_486
- __asm__("bswap %0" : "=r" (val) : "0" (val));
-#else
- __asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */
- "rorl $16,%0\n\t" /* swap words */
- "xchgb %b0,%h0" /* swap higher bytes */
- :"=q" (val)
- : "0" (val));
-#endif
- return val;
-}
-
-_INLINE_ __u16 ext2fs_swab16(__u16 val)
-{
- __asm__("xchgb %b0,%h0" /* swap bytes */ \
- : "=q" (val) \
- : "0" (val)); \
- return val;
-}
-
-#undef EXT2FS_ADDR
-
-#endif /* i386 */
-
-
-#if !defined(_EXT2_HAVE_ASM_SWAB_)
-
_INLINE_ __u16 ext2fs_swab16(__u16 val)
{
return (val >> 8) | (__u16) (val << 8);
@@ -380,8 +288,6 @@ _INLINE_ __u32 ext2fs_swab32(__u32 val)
((val<<8)&0xFF0000) | (val<<24));
}
-#endif /* !_EXT2_HAVE_ASM_SWAB */
-
_INLINE_ __u64 ext2fs_swab64(__u64 val)
{
return (ext2fs_swab32((__u32) (val >> 32)) |
@@ -691,12 +597,9 @@ _INLINE_ void ext2fs_fast_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
#undef _INLINE_
#endif
-#ifndef _EXT2_HAVE_ASM_BITOPS_
extern int ext2fs_set_bit(unsigned int nr,void * addr);
extern int ext2fs_clear_bit(unsigned int nr, void * addr);
extern int ext2fs_test_bit(unsigned int nr, const void * addr);
-#endif
-
extern int ext2fs_set_bit64(__u64 nr,void * addr);
extern int ext2fs_clear_bit64(__u64 nr, void * addr);
extern int ext2fs_test_bit64(__u64 nr, const void * addr);
diff --git a/lib/ext2fs/ext2_io.h b/lib/ext2fs/ext2_io.h
index 8fe5b323..679184e3 100644
--- a/lib/ext2fs/ext2_io.h
+++ b/lib/ext2fs/ext2_io.h
@@ -145,10 +145,12 @@ extern errcode_t io_channel_cache_readahead(io_channel io,
#ifdef _WIN32
/* windows_io.c */
extern io_manager windows_io_manager;
+#define default_io_manager windows_io_manager
#else
/* unix_io.c */
extern io_manager unix_io_manager;
extern io_manager unixfd_io_manager;
+#define default_io_manager unix_io_manager
#endif
/* sparse_io.c */
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
index 9cc994b1..80206870 100644
--- a/lib/ext2fs/ext2fs.h
+++ b/lib/ext2fs/ext2fs.h
@@ -355,9 +355,9 @@ struct struct_ext2_filsys {
#define BLOCK_INLINE_DATA_CHANGED 8
/*
- * Block interate flags
+ * Block iterate flags
*
- * BLOCK_FLAG_APPEND, or BLOCK_FLAG_HOLE, indicates that the interator
+ * BLOCK_FLAG_APPEND, or BLOCK_FLAG_HOLE, indicates that the iterator
* function should be called on blocks where the block number is zero.
* This is used by ext2fs_expand_dir() to be able to add a new block
* to an inode. It can also be used for programs that want to be able
diff --git a/lib/ext2fs/ext2fsP.h b/lib/ext2fs/ext2fsP.h
index a20a0502..06873847 100644
--- a/lib/ext2fs/ext2fsP.h
+++ b/lib/ext2fs/ext2fsP.h
@@ -93,7 +93,7 @@ struct ext2_inode_cache_ent {
};
/*
- * NLS defintions
+ * NLS definitions
*/
struct ext2fs_nls_table {
int version;
diff --git a/lib/ext2fs/gen_bitmap64.c b/lib/ext2fs/gen_bitmap64.c
index c860c10e..4289e815 100644
--- a/lib/ext2fs/gen_bitmap64.c
+++ b/lib/ext2fs/gen_bitmap64.c
@@ -183,11 +183,9 @@ static void ext2fs_print_bmap_statistics(ext2fs_generic_bitmap_64 bitmap)
#ifdef ENABLE_BMAP_STATS_OPS
float mark_seq_perc = 0.0, test_seq_perc = 0.0;
float mark_back_perc = 0.0, test_back_perc = 0.0;
-#endif
- double inuse;
struct timeval now;
+ double inuse;
-#ifdef ENABLE_BMAP_STATS_OPS
if (stats->test_count) {
test_seq_perc = ((float)stats->test_seq /
stats->test_count) * 100;
@@ -201,7 +199,6 @@ static void ext2fs_print_bmap_statistics(ext2fs_generic_bitmap_64 bitmap)
mark_back_perc = ((float)stats->mark_back /
stats->mark_count) * 100;
}
-#endif
if (gettimeofday(&now, (struct timezone *) NULL) == -1) {
perror("gettimeofday");
@@ -212,6 +209,7 @@ static void ext2fs_print_bmap_statistics(ext2fs_generic_bitmap_64 bitmap)
(((double) now.tv_usec) * 0.000001);
inuse -= (double) stats->created.tv_sec + \
(((double) stats->created.tv_usec) * 0.000001);
+#endif /* ENABLE_BMAP_STATS_OPS */
fprintf(stderr, "\n[+] %s bitmap (type %d)\n", bitmap->description,
stats->type);
@@ -629,10 +627,14 @@ errcode_t ext2fs_compare_generic_bmap(errcode_t neq,
(bm1->end != bm2->end))
return neq;
- for (i = bm1->end - ((bm1->end - bm1->start) % 8); i <= bm1->end; i++)
- if (ext2fs_test_generic_bmap(gen_bm1, i) !=
- ext2fs_test_generic_bmap(gen_bm2, i))
+ for (i = bm1->start; i < bm1->end; i++) {
+ int ret1, ret2;
+ ret1 = !!ext2fs_test_generic_bmap(gen_bm1, i);
+ ret2 = !!ext2fs_test_generic_bmap(gen_bm2, i);
+ if (ret1 != ret2) {
return neq;
+ }
+ }
return 0;
}
diff --git a/lib/ext2fs/getsectsize.c b/lib/ext2fs/getsectsize.c
index 3a461eb9..bd978c53 100644
--- a/lib/ext2fs/getsectsize.c
+++ b/lib/ext2fs/getsectsize.c
@@ -51,10 +51,10 @@
*/
errcode_t ext2fs_get_device_sectsize(const char *file, int *sectsize)
{
-#ifdef _WIN64
+#ifdef _WIN32
*sectsize = 512; // just guessing
return 0;
-#else // not _WIN64
+#else // not _WIN32
int fd;
@@ -78,7 +78,7 @@ errcode_t ext2fs_get_device_sectsize(const char *file, int *sectsize)
close(fd);
return 0;
-#endif // ifdef _WIN64
+#endif // ifdef _WIN32
}
/*
@@ -117,11 +117,11 @@ int ext2fs_get_dio_alignment(int fd)
*/
errcode_t ext2fs_get_device_phys_sectsize(const char *file, int *sectsize)
{
-#ifdef _WIN64
+#ifdef _WIN32
return ext2fs_get_device_sectsize(file, sectsize);
-#else // not _WIN64
+#else // not _WIN32
int fd;
@@ -147,5 +147,5 @@ errcode_t ext2fs_get_device_phys_sectsize(const char *file, int *sectsize)
close(fd);
return 0;
-#endif // ifdef _WIN64
+#endif // ifdef _WIN32
}
diff --git a/lib/ext2fs/inline_data.c b/lib/ext2fs/inline_data.c
index b62fb676..bd52e377 100644
--- a/lib/ext2fs/inline_data.c
+++ b/lib/ext2fs/inline_data.c
@@ -653,7 +653,7 @@ static errcode_t file_test(ext2_filsys fs)
if (size != BUFF_SIZE) {
fprintf(stderr,
- "tst_inline_data: size %lu != buflen %u\n",
+ "tst_inline_data: size %zu != buflen %u\n",
size, BUFF_SIZE);
retval = 1;
goto err;
diff --git a/lib/ext2fs/irel.h b/lib/ext2fs/irel.h
index 8aaa2d2b..23741bae 100644
--- a/lib/ext2fs/irel.h
+++ b/lib/ext2fs/irel.h
@@ -73,7 +73,7 @@ struct ext2_inode_relocation_table {
/*
* The iterator function for the inode references for an
- * inode. The references for only one inode can be interator
+ * inode. The references for only one inode can be iterator
* over at a time, as the iterator state is stored in ext2_irel.
*/
errcode_t (*next_ref)(ext2_irel irel,
diff --git a/lib/ext2fs/ismounted.c b/lib/ext2fs/ismounted.c
index f4fcdfd0..22bc8352 100644
--- a/lib/ext2fs/ismounted.c
+++ b/lib/ext2fs/ismounted.c
@@ -97,7 +97,7 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file,
int *mount_flags, char *mtpt, int mtlen)
{
struct mntent *mnt;
- struct stat st_buf;
+ struct stat st_buf, dir_st_buf;
errcode_t retval = 0;
dev_t file_dev=0, file_rdev=0;
ino_t file_ino=0;
@@ -144,8 +144,14 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file,
if (stat(mnt->mnt_fsname, &st_buf) == 0) {
if (ext2fsP_is_disk_device(st_buf.st_mode)) {
#ifndef __GNU__
- if (file_rdev && (file_rdev == st_buf.st_rdev))
- break;
+ if (file_rdev &&
+ (file_rdev == st_buf.st_rdev)) {
+ if (stat(mnt->mnt_dir,
+ &dir_st_buf) != 0)
+ continue;
+ if (file_rdev == dir_st_buf.st_dev)
+ break;
+ }
if (check_loop_mounted(mnt->mnt_fsname,
st_buf.st_rdev, file_dev,
file_ino) == 1)
diff --git a/lib/ext2fs/jfs_compat.h b/lib/ext2fs/jfs_compat.h
index e11cf494..0e96b56c 100644
--- a/lib/ext2fs/jfs_compat.h
+++ b/lib/ext2fs/jfs_compat.h
@@ -7,11 +7,7 @@
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
-#ifdef HAVE_WINSOCK_H
-#include <winsock.h>
-#else
#include <arpa/inet.h>
-#endif
#include <stdbool.h>
#define printk printf
diff --git a/lib/ext2fs/kernel-jbd.h b/lib/ext2fs/kernel-jbd.h
index 28119572..e5695006 100644
--- a/lib/ext2fs/kernel-jbd.h
+++ b/lib/ext2fs/kernel-jbd.h
@@ -444,7 +444,7 @@ extern int journal_blocks_per_page(struct inode *inode);
#define BJ_SyncData 1 /* Normal data: flush before commit */
#define BJ_AsyncData 2 /* writepage data: wait on it before commit */
#define BJ_Metadata 3 /* Normal journaled metadata */
-#define BJ_Forget 4 /* Buffer superceded by this transaction */
+#define BJ_Forget 4 /* Buffer superseded by this transaction */
#define BJ_IO 5 /* Buffer is for temporary IO use */
#define BJ_Shadow 6 /* Buffer contents being shadowed to the log */
#define BJ_LogCtl 7 /* Buffer contains log descriptors */
diff --git a/lib/ext2fs/mmp.c b/lib/ext2fs/mmp.c
index 7970aac2..eb941702 100644
--- a/lib/ext2fs/mmp.c
+++ b/lib/ext2fs/mmp.c
@@ -356,7 +356,7 @@ clean_seq:
#ifdef HAVE_GETHOSTNAME
gethostname((char *) mmp_s->mmp_nodename, sizeof(mmp_s->mmp_nodename));
#else
- strcpy(mmp_s->mmp_nodename, "unknown host");
+ strcpy((char *) mmp_s->mmp_nodename, "unknown host");
#endif
strncpy((char *) mmp_s->mmp_bdevname, fs->device_name,
sizeof(mmp_s->mmp_bdevname));
@@ -407,7 +407,7 @@ errcode_t ext2fs_mmp_stop(ext2_filsys fs)
(fs->mmp_buf == NULL) || (fs->mmp_cmp == NULL))
goto mmp_error;
- retval = ext2fs_mmp_read(fs, fs->super->s_mmp_block, fs->mmp_buf);
+ retval = ext2fs_mmp_read(fs, fs->super->s_mmp_block, NULL);
if (retval)
goto mmp_error;
diff --git a/lib/ext2fs/nls_utf8.c b/lib/ext2fs/nls_utf8.c
index 43bab9a3..b07e66e4 100644
--- a/lib/ext2fs/nls_utf8.c
+++ b/lib/ext2fs/nls_utf8.c
@@ -709,7 +709,7 @@ static int utf8cursor(struct utf8cursor *u8c, const struct utf8data *data,
/*
* Get one byte from the normalized form of the string described by u8c.
*
- * Returns the byte cast to an unsigned char on succes, and -1 on failure.
+ * Returns the byte cast to an unsigned char on success, and -1 on failure.
*
* The cursor keeps track of the location in the string in u8c->s.
* When a character is decomposed, the current location is stored in
diff --git a/lib/ext2fs/sha256.c b/lib/ext2fs/sha256.c
index f67848d4..b1506e2d 100644
--- a/lib/ext2fs/sha256.c
+++ b/lib/ext2fs/sha256.c
@@ -180,7 +180,7 @@ static void sha256_done(struct hash_state * md, unsigned char *out)
md->sha256.curlen = 0;
}
- /* pad upto 56 bytes of zeroes */
+ /* pad up to 56 bytes of zeroes */
while (md->sha256.curlen < 56) {
md->sha256.buf[md->sha256.curlen++] = (unsigned char)0;
}
diff --git a/lib/ext2fs/sha512.c b/lib/ext2fs/sha512.c
index fe2dd52e..f246afb5 100644
--- a/lib/ext2fs/sha512.c
+++ b/lib/ext2fs/sha512.c
@@ -185,7 +185,7 @@ static void sha512_done(struct hash_state * md, unsigned char *out)
md->sha512.curlen = 0;
}
- /* pad upto 120 bytes of zeroes note: that from 112 to 120 is the 64 MSB
+ /* pad up to 120 bytes of zeroes note: that from 112 to 120 is the 64 MSB
* of the length. We assume that you won't hash > 2^64 bits of data. */
while (md->sha512.curlen < 120) {
md->sha512.buf[md->sha512.curlen++] = (unsigned char)0;
diff --git a/lib/ext2fs/windows_io.c b/lib/ext2fs/windows_io.c
index 68b5571b..83aea68b 100644
--- a/lib/ext2fs/windows_io.c
+++ b/lib/ext2fs/windows_io.c
@@ -499,9 +499,6 @@ static errcode_t windows_open_channel(struct windows_private_data *data,
#if defined(O_DIRECT)
if (flags & IO_FLAG_DIRECT_IO)
io->align = ext2fs_get_dio_alignment(data->dev);
-#elif defined(F_NOCACHE)
- if (flags & IO_FLAG_DIRECT_IO)
- io->align = 4096;
#endif
/*
@@ -609,7 +606,7 @@ static struct windows_private_data *init_private_data(const char *name, int flag
return NULL;
memset(data, 0, sizeof(struct windows_private_data));
- strncpy(data->name, name, sizeof(data->name));
+ strncpy(data->name, name, sizeof(data->name) - 1);
data->magic = EXT2_ET_MAGIC_WINDOWS_IO_CHANNEL;
data->io_stats.num_fields = 2;
data->flags = flags;
@@ -620,7 +617,6 @@ static struct windows_private_data *init_private_data(const char *name, int flag
static errcode_t windows_open(const char *name, int flags, io_channel *channel)
{
- int fd = -1;
int open_flags;
struct windows_private_data *data;
@@ -644,12 +640,6 @@ static errcode_t windows_open(const char *name, int flags, io_channel *channel)
return EXT2_ET_BAD_DEVICE_NAME;
}
-#if defined(F_NOCACHE) && !defined(IO_DIRECT)
- if (flags & IO_FLAG_DIRECT_IO) {
- if (fcntl(fd, F_NOCACHE, 1) < 0)
- return errno;
- }
-#endif
return windows_open_channel(data, flags, channel, windows_io_manager);
}
diff --git a/lib/ss/Makefile.in b/lib/ss/Makefile.in
index 40294db0..bb504189 100644
--- a/lib/ss/Makefile.in
+++ b/lib/ss/Makefile.in
@@ -125,10 +125,11 @@ ss.pc: $(srcdir)/ss.pc.in $(top_builddir)/config.status
$(Q) cd $(top_builddir); CONFIG_FILES=lib/ss/ss.pc ./config.status
installdirs::
- $(E) " MKDIR_P $(libdir) $(includedir)/ss $(datadir)/ss $(bindir)"
+ $(E) " MKDIR_P $(libdir) $(includedir)/ss $(datadir)/ss $(bindir) $(pkgconfigdir) $(man1dir)"
$(Q) $(MKDIR_P) $(DESTDIR)$(libdir) \
$(DESTDIR)$(includedir)/ss $(DESTDIR)$(datadir)/ss \
- $(DESTDIR)$(bindir) $(DESTDIR)$(pkgconfigdir)
+ $(DESTDIR)$(bindir) $(DESTDIR)$(pkgconfigdir) \
+ $(DESTDIR)$(man1dir)
install:: libss.a $(INSTALL_HFILES) installdirs ss_err.h mk_cmds ss.pc
$(E) " INSTALL_DATA $(DESTDIR)$(libdir)/libss.a"
diff --git a/lib/ss/execute_cmd.c b/lib/ss/execute_cmd.c
index 2e2c8cfa..d092134a 100644
--- a/lib/ss/execute_cmd.c
+++ b/lib/ss/execute_cmd.c
@@ -17,8 +17,6 @@
#endif
#ifdef HAVE_ERRNO_H
#include <errno.h>
-#else
-extern int errno;
#endif
#include "ss_internal.h"
#include <stdio.h>
diff --git a/lib/ss/help.c b/lib/ss/help.c
index a22b4017..54c78f23 100644
--- a/lib/ss/help.c
+++ b/lib/ss/help.c
@@ -20,8 +20,6 @@
#endif
#ifdef HAVE_ERRNO_H
#include <errno.h>
-#else
-extern int errno;
#endif
#include <fcntl.h>
#include <sys/param.h>
diff --git a/lib/ss/pager.c b/lib/ss/pager.c
index b9b88996..ba32b201 100644
--- a/lib/ss/pager.c
+++ b/lib/ss/pager.c
@@ -20,8 +20,6 @@
#endif
#ifdef HAVE_ERRNO_H
#include <errno.h>
-#else
-extern int errno;
#endif
#include "ss_internal.h"
diff --git a/lib/support/devname.c b/lib/support/devname.c
index 8c2349a3..e0306ddf 100644
--- a/lib/support/devname.c
+++ b/lib/support/devname.c
@@ -58,7 +58,6 @@ char *get_devname(blkid_cache cache, const char *token, const char *value)
goto out;
}
-out_strdup:
if (is_file)
ret = strdup(token);
out:
diff --git a/lib/support/plausible.c b/lib/support/plausible.c
index bbed2a70..65a6b2e1 100644
--- a/lib/support/plausible.c
+++ b/lib/support/plausible.c
@@ -103,12 +103,7 @@ static void print_ext2_info(const char *device)
time_t tm;
retval = ext2fs_open2(device, 0, EXT2_FLAG_64BITS, 0, 0,
-#ifdef _WIN64
- windows_io_manager,
-#else
- unix_io_manager,
-#endif
- &fs);
+ default_io_manager, &fs);
if (retval)
return;
sb = fs->super;
diff --git a/lib/support/print_fs_flags.c b/lib/support/print_fs_flags.c
index e54acc04..f47cd665 100644
--- a/lib/support/print_fs_flags.c
+++ b/lib/support/print_fs_flags.c
@@ -21,40 +21,40 @@ struct flags_name {
const char *name;
};
-static struct flags_name flags_array[] = {
- EXT2_FLAG_RW, "EXT2_FLAG_RW",
- EXT2_FLAG_CHANGED, "EXT2_FLAG_CHANGED",
- EXT2_FLAG_DIRTY, "EXT2_FLAG_DIRTY",
- EXT2_FLAG_VALID, "EXT2_FLAG_VALID",
- EXT2_FLAG_IB_DIRTY, "EXT2_FLAG_IB_DIRTY",
- EXT2_FLAG_BB_DIRTY, "EXT2_FLAG_BB_DIRTY",
- EXT2_FLAG_SWAP_BYTES, "EXT2_FLAG_SWAP_BYTES",
- EXT2_FLAG_SWAP_BYTES_READ, "EXT2_FLAG_SWAP_BYTES_READ",
- EXT2_FLAG_SWAP_BYTES_WRITE, "EXT2_FLAG_SWAP_BYTES_WRITE",
- EXT2_FLAG_MASTER_SB_ONLY, "EXT2_FLAG_MASTER_SB_ONLY",
- EXT2_FLAG_FORCE, "EXT2_FLAG_FORCE",
- EXT2_FLAG_SUPER_ONLY, "EXT2_FLAG_SUPER_ONLY",
- EXT2_FLAG_JOURNAL_DEV_OK, "EXT2_FLAG_JOURNAL_DEV_OK",
- EXT2_FLAG_IMAGE_FILE, "EXT2_FLAG_IMAGE_FILE",
- EXT2_FLAG_EXCLUSIVE, "EXT2_FLAG_EXCLUSIVE",
- EXT2_FLAG_SOFTSUPP_FEATURES, "EXT2_FLAG_SOFTSUPP_FEATURES",
- EXT2_FLAG_NOFREE_ON_ERROR, "EXT2_FLAG_NOFREE_ON_ERROR",
- EXT2_FLAG_64BITS, "EXT2_FLAG_64BITS",
- EXT2_FLAG_PRINT_PROGRESS, "EXT2_FLAG_PRINT_PROGRESS",
- EXT2_FLAG_DIRECT_IO, "EXT2_FLAG_DIRECT_IO",
- EXT2_FLAG_SKIP_MMP, "EXT2_FLAG_SKIP_MMP",
- EXT2_FLAG_IGNORE_CSUM_ERRORS, "EXT2_FLAG_IGNORE_CSUM_ERRORS",
- EXT2_FLAG_SHARE_DUP, "EXT2_FLAG_SHARE_DUP",
- EXT2_FLAG_IGNORE_SB_ERRORS, "EXT2_FLAG_IGNORE_SB_ERRORS",
- EXT2_FLAG_BBITMAP_TAIL_PROBLEM, "EXT2_FLAG_BBITMAP_TAIL_PROBLEM",
- EXT2_FLAG_IBITMAP_TAIL_PROBLEM, "EXT2_FLAG_IBITMAP_TAIL_PROBLEM",
- EXT2_FLAG_THREADS, "EXT2_FLAG_THREADS",
- 0
+static const struct flags_name flags_array[] = {
+ { EXT2_FLAG_RW, "EXT2_FLAG_RW" },
+ { EXT2_FLAG_CHANGED, "EXT2_FLAG_CHANGED" },
+ { EXT2_FLAG_DIRTY, "EXT2_FLAG_DIRTY" },
+ { EXT2_FLAG_VALID, "EXT2_FLAG_VALID" },
+ { EXT2_FLAG_IB_DIRTY, "EXT2_FLAG_IB_DIRTY" },
+ { EXT2_FLAG_BB_DIRTY, "EXT2_FLAG_BB_DIRTY" },
+ { EXT2_FLAG_SWAP_BYTES, "EXT2_FLAG_SWAP_BYTES" },
+ { EXT2_FLAG_SWAP_BYTES_READ, "EXT2_FLAG_SWAP_BYTES_READ" },
+ { EXT2_FLAG_SWAP_BYTES_WRITE, "EXT2_FLAG_SWAP_BYTES_WRITE" },
+ { EXT2_FLAG_MASTER_SB_ONLY, "EXT2_FLAG_MASTER_SB_ONLY" },
+ { EXT2_FLAG_FORCE, "EXT2_FLAG_FORCE" },
+ { EXT2_FLAG_SUPER_ONLY, "EXT2_FLAG_SUPER_ONLY" },
+ { EXT2_FLAG_JOURNAL_DEV_OK, "EXT2_FLAG_JOURNAL_DEV_OK" },
+ { EXT2_FLAG_IMAGE_FILE, "EXT2_FLAG_IMAGE_FILE" },
+ { EXT2_FLAG_EXCLUSIVE, "EXT2_FLAG_EXCLUSIVE" },
+ { EXT2_FLAG_SOFTSUPP_FEATURES, "EXT2_FLAG_SOFTSUPP_FEATURES" },
+ { EXT2_FLAG_NOFREE_ON_ERROR, "EXT2_FLAG_NOFREE_ON_ERROR" },
+ { EXT2_FLAG_64BITS, "EXT2_FLAG_64BITS" },
+ { EXT2_FLAG_PRINT_PROGRESS, "EXT2_FLAG_PRINT_PROGRESS" },
+ { EXT2_FLAG_DIRECT_IO, "EXT2_FLAG_DIRECT_IO" },
+ { EXT2_FLAG_SKIP_MMP, "EXT2_FLAG_SKIP_MMP" },
+ { EXT2_FLAG_IGNORE_CSUM_ERRORS, "EXT2_FLAG_IGNORE_CSUM_ERRORS" },
+ { EXT2_FLAG_SHARE_DUP, "EXT2_FLAG_SHARE_DUP" },
+ { EXT2_FLAG_IGNORE_SB_ERRORS, "EXT2_FLAG_IGNORE_SB_ERRORS" },
+ { EXT2_FLAG_BBITMAP_TAIL_PROBLEM, "EXT2_FLAG_BBITMAP_TAIL_PROBLEM" },
+ { EXT2_FLAG_IBITMAP_TAIL_PROBLEM, "EXT2_FLAG_IBITMAP_TAIL_PROBLEM" },
+ { EXT2_FLAG_THREADS, "EXT2_FLAG_THREADS" },
+ { 0, NULL },
};
void print_fs_flags(FILE * f, unsigned long flags)
{
- struct flags_name *fp;
+ const struct flags_name *fp;
int first = 1, pos = 16;
for (fp = flags_array; fp->flag != 0; fp++) {
diff --git a/lib/support/profile.c b/lib/support/profile.c
index f54739e7..bdb14b17 100644
--- a/lib/support/profile.c
+++ b/lib/support/profile.c
@@ -1191,7 +1191,7 @@ errcode_t profile_add_node(struct profile_node *section, const char *name,
/*
* Iterate through the section, returning the nodes which match
- * the given name. If name is NULL, then interate through all the
+ * the given name. If name is NULL, then iterate through all the
* nodes in the section. If section_flag is non-zero, only return the
* section which matches the name; don't return relations. If value
* is non-NULL, then only return relations which match the requested
diff --git a/lib/support/quotaio_v2.c b/lib/support/quotaio_v2.c
index a49aa6ac..d09294be 100644
--- a/lib/support/quotaio_v2.c
+++ b/lib/support/quotaio_v2.c
@@ -223,7 +223,7 @@ static int v2_check_file(struct quota_handle *h, int type, int fmt)
be_magic = ext2fs_be32_to_cpu((__force __be32)dqh.dqh_magic);
if (be_magic == file_magics[type]) {
- log_err("Your quota file is stored in wrong endianity");
+ log_err("Your quota file is stored in wrong endianness");
return 0;
}
if (V2_VERSION_R0 != ext2fs_le32_to_cpu(dqh.dqh_version) &&
diff --git a/lib/support/sort_r.h b/lib/support/sort_r.h
index 3292a26a..ebf78378 100644
--- a/lib/support/sort_r.h
+++ b/lib/support/sort_r.h
@@ -24,7 +24,11 @@ void sort_r(void *base, size_t nel, size_t width,
#define _SORT_R_INLINE inline
-#if (defined __gnu_hurd__ || defined __GNU__ || \
+#if (defined HAVE_GNU_QSORT_R)
+# define _SORT_R_LINUX
+#elif (defined HAVE_BSD_QSORT_R)
+# define _SORT_R_BSD
+#elif (defined __gnu_hurd__ || defined __GNU__ || \
defined __linux__ || defined __MINGW32__ || defined __GLIBC__)
# define _SORT_R_LINUX
#elif (defined __APPLE__ || defined __MACH__ || defined __DARWIN__ || \
diff --git a/lib/uuid/gen_uuid.c b/lib/uuid/gen_uuid.c
index 14c98eb4..a2225cce 100644
--- a/lib/uuid/gen_uuid.c
+++ b/lib/uuid/gen_uuid.c
@@ -117,27 +117,6 @@
THREAD_LOCAL unsigned short jrand_seed[3];
#endif
-#ifdef _WIN32
-#ifndef USE_MINGW
-static void gettimeofday (struct timeval *tv, void *dummy)
-{
- FILETIME ftime;
- uint64_t n;
-
- GetSystemTimeAsFileTime (&ftime);
- n = (((uint64_t) ftime.dwHighDateTime << 32)
- + (uint64_t) ftime.dwLowDateTime);
- if (n) {
- n /= 10;
- n -= ((369 * 365 + 89) * (uint64_t) 86400) * 1000000;
- }
-
- tv->tv_sec = n / 1000000;
- tv->tv_usec = n % 1000000;
-}
-#endif
-#endif
-
static int get_random_fd(void)
{
struct timeval tv;
diff --git a/misc/Android.bp b/misc/Android.bp
index 78e18e42..2b1620ac 100644
--- a/misc/Android.bp
+++ b/misc/Android.bp
@@ -83,15 +83,12 @@ cc_binary {
windows: {
include_dirs: [ "external/e2fsprogs/include/mingw" ],
cflags: [
- "-D_POSIX",
- "-D__USE_MINGW_ALARM",
// mke2fs.c has a warning from gcc which cannot be suppressed:
// passing argument 3 of 'ext2fs_get_device_size' from
// incompatible pointer type
"-Wno-error"
],
ldflags: ["-static"],
- host_ldlibs: ["-lws2_32"],
enabled: true
},
android: {
diff --git a/misc/base_device.c b/misc/base_device.c
index d1c1cd94..814a4791 100644
--- a/misc/base_device.c
+++ b/misc/base_device.c
@@ -33,7 +33,7 @@
/*
* Required for the uber-silly devfs /dev/ide/host1/bus2/target3/lun3
- * pathames.
+ * pathnames.
*/
static const char *devfs_hier[] = {
"host", "bus", "target", "lun", 0
diff --git a/misc/create_inode.c b/misc/create_inode.c
index c00d5458..a3a34cd9 100644
--- a/misc/create_inode.c
+++ b/misc/create_inode.c
@@ -150,6 +150,8 @@ static errcode_t set_inode_xattr(ext2_filsys fs, ext2_ino_t ino,
size = llistxattr(filename, NULL, 0);
if (size == -1) {
+ if (errno == ENOTSUP)
+ return 0;
retval = errno;
com_err(__func__, retval, _("while listing attributes of \"%s\""),
filename);
@@ -763,39 +765,33 @@ static int scandir(const char *dir_name, struct dirent ***name_list,
size_t new_list_size = temp_list_size + 32;
struct dirent **new_list = (struct dirent**)realloc(
temp_list, new_list_size * sizeof(struct dirent*));
- if (new_list == NULL) {
- goto out;
- }
+ if (new_list == NULL)
+ goto out_err;
temp_list_size = new_list_size;
temp_list = new_list;
}
// add the copy of dirent to the list
temp_list[num_dent] = (struct dirent*)malloc((dent->d_reclen + 3) & ~3);
if (!temp_list[num_dent])
- goto out;
+ goto out_err;
memcpy(temp_list[num_dent], dent, dent->d_reclen);
num_dent++;
}
+ closedir(dir);
if (compar != NULL) {
qsort(temp_list, num_dent, sizeof(struct dirent*),
(int (*)(const void*, const void*))compar);
}
-
- // release the temp list
*name_list = temp_list;
- temp_list = NULL;
+ return num_dent;
-out:
- if (temp_list != NULL) {
- while (num_dent > 0) {
- free(temp_list[--num_dent]);
- }
- free(temp_list);
- num_dent = -1;
- }
+out_err:
closedir(dir);
- return num_dent;
+ while (num_dent > 0)
+ free(temp_list[--num_dent]);
+ free(temp_list);
+ return -1;
}
static int alphasort(const struct dirent **a, const struct dirent **b) {
@@ -813,11 +809,9 @@ static errcode_t __populate_fs(ext2_filsys fs, ext2_ino_t parent_ino,
const char *name;
struct dirent **dent;
struct stat st;
- char *ln_target = NULL;
unsigned int save_inode;
ext2_ino_t ino;
errcode_t retval = 0;
- int read_cnt;
int hdlink;
size_t cur_dir_path_len;
int i, num_dents;
@@ -900,7 +894,10 @@ static errcode_t __populate_fs(ext2_filsys fs, ext2_ino_t parent_ino,
goto out;
}
break;
- case S_IFLNK:
+ case S_IFLNK: {
+ char *ln_target;
+ int read_cnt;
+
ln_target = malloc(st.st_size + 1);
if (ln_target == NULL) {
com_err(__func__, retval,
@@ -935,7 +932,8 @@ static errcode_t __populate_fs(ext2_filsys fs, ext2_ino_t parent_ino,
goto out;
}
break;
-#endif
+ }
+#endif /* !_WIN32 */
case S_IFREG:
retval = do_write_internal(fs, parent_ino, name, name,
root);
diff --git a/misc/e4defrag.c b/misc/e4defrag.c
index 9ec265f2..33bd05d2 100644
--- a/misc/e4defrag.c
+++ b/misc/e4defrag.c
@@ -258,12 +258,12 @@ static int get_mount_point(const char *devname, char *mount_point,
*
* @file: the file's name.
*/
-static int is_ext4(const char *file, char *devname)
+static int is_ext4(const char *file, char devname[PATH_MAX + 1])
{
int maxlen = 0;
int len, ret;
+ int type_is_ext4 = 0;
FILE *fp = NULL;
- char *mnt_type = NULL;
/* Refer to /etc/mtab */
const char *mtab = MOUNTED;
char file_path[PATH_MAX + 1];
@@ -307,26 +307,16 @@ static int is_ext4(const char *file, char *devname)
maxlen = len;
- mnt_type = realloc(mnt_type, strlen(mnt->mnt_type) + 1);
- if (mnt_type == NULL) {
- endmntent(fp);
- return -1;
- }
- memset(mnt_type, 0, strlen(mnt->mnt_type) + 1);
- strncpy(mnt_type, mnt->mnt_type, strlen(mnt->mnt_type));
+ type_is_ext4 = !strcmp(mnt->mnt_type, FS_EXT4);
strncpy(lost_found_dir, mnt->mnt_dir, PATH_MAX);
- strncpy(devname, mnt->mnt_fsname, strlen(mnt->mnt_fsname) + 1);
+ strncpy(devname, mnt->mnt_fsname, PATH_MAX);
}
endmntent(fp);
- if (mnt_type && strcmp(mnt_type, FS_EXT4) == 0) {
- FREE(mnt_type);
+ if (type_is_ext4)
return 0;
- } else {
- FREE(mnt_type);
- PRINT_ERR_MSG(NGMSG_EXT4);
- return -1;
- }
+ PRINT_ERR_MSG(NGMSG_EXT4);
+ return -1;
}
/*
@@ -1865,11 +1855,9 @@ int main(int argc, char *argv[])
/* fall through */
case DEVNAME:
if (arg_type == DEVNAME) {
- strncpy(lost_found_dir, dir_name,
- strnlen(dir_name, PATH_MAX));
+ strcpy(lost_found_dir, dir_name);
strncat(lost_found_dir, "/lost+found/",
- PATH_MAX - strnlen(lost_found_dir,
- PATH_MAX));
+ PATH_MAX - strlen(lost_found_dir));
}
nftw64(dir_name, calc_entry_counts, FTW_OPEN_FD, flags);
diff --git a/misc/fsck.c b/misc/fsck.c
index 1f6ec7d9..1769a106 100644
--- a/misc/fsck.c
+++ b/misc/fsck.c
@@ -547,6 +547,8 @@ static int kill_all(int signum)
for (inst = instance_list; inst; inst = inst->next) {
if (inst->flags & FLAG_DONE)
continue;
+ if (inst->pid <= 0)
+ continue;
kill(inst->pid, signum);
n++;
}
diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index c5957212..6d4bcf4f 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -2508,9 +2508,10 @@ static int copy_names(char *name, char *value EXT2FS_ATTR((unused)),
size_t value_len EXT2FS_ATTR((unused)), void *data)
{
char **b = data;
+ size_t name_len = strlen(name);
- strncpy(*b, name, strlen(name));
- *b = *b + strlen(name) + 1;
+ memcpy(*b, name, name_len + 1);
+ *b = *b + name_len + 1;
return 0;
}
diff --git a/misc/mk_hugefiles.c b/misc/mk_hugefiles.c
index 0280b41e..3caaf1b6 100644
--- a/misc/mk_hugefiles.c
+++ b/misc/mk_hugefiles.c
@@ -2,13 +2,8 @@
* mk_hugefiles.c -- create huge files
*/
-#define _XOPEN_SOURCE 600 /* for inclusion of PATH_MAX in Solaris */
-#define _BSD_SOURCE /* for makedev() and major() */
-#define _DEFAULT_SOURCE /* since glibc 2.20 _BSD_SOURCE is deprecated */
-
#include "config.h"
#include <stdio.h>
-#include <stdarg.h>
#include <string.h>
#include <strings.h>
#include <fcntl.h>
@@ -68,141 +63,30 @@ static char *fn_buf;
static char *fn_numbuf;
int zero_hugefile = 1;
-#define SYSFS_PATH_LEN 300
-typedef char sysfs_path_t[SYSFS_PATH_LEN];
-
-#ifndef HAVE_SNPRINTF
-/*
- * We are very careful to avoid needing to worry about buffer
- * overflows, so we don't really need to use snprintf() except as an
- * additional safety check. So if snprintf() is not present, it's
- * safe to fall back to vsprintf(). This provides portability since
- * vsprintf() is guaranteed by C89, while snprintf() is only
- * guaranteed by C99 --- which for example, Microsoft Visual Studio
- * has *still* not bothered to implement. :-/ (Not that I expect
- * mke2fs to be ported to MS Visual Studio any time soon, but
- * libext2fs *does* get built on Microsoft platforms, and we might
- * want to move this into libext2fs some day.)
- */
-static int my_snprintf(char *str, size_t size, const char *format, ...)
-{
- va_list ap;
- int ret;
-
- va_start(ap, format);
- ret = vsprintf(str, format, ap);
- va_end(ap);
- return ret;
-}
-
-#define snprintf my_snprintf
-#endif
-
-/*
- * Fall back to Linux's definitions of makedev and major are needed.
- * The search_sysfs_block() function is highly unlikely to work on
- * non-Linux systems anyway.
- */
-#ifndef makedev
-#define makedev(maj, min) (((maj) << 8) + (min))
-#endif
-
-static char *search_sysfs_block(dev_t devno, sysfs_path_t ret_path)
-{
- struct dirent *de, *p_de;
- DIR *dir = NULL, *p_dir = NULL;
- FILE *f;
- sysfs_path_t path, p_path;
- unsigned int major, minor;
- char *ret = ret_path;
-
- ret_path[0] = 0;
- if ((dir = opendir("/sys/block")) == NULL)
- return NULL;
- while ((de = readdir(dir)) != NULL) {
- if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, "..") ||
- strlen(de->d_name) > sizeof(path)-32)
- continue;
- snprintf(path, SYSFS_PATH_LEN,
- "/sys/block/%s/dev", de->d_name);
- f = fopen(path, "r");
- if (f &&
- (fscanf(f, "%u:%u", &major, &minor) == 2)) {
- fclose(f); f = NULL;
- if (makedev(major, minor) == devno) {
- snprintf(ret_path, SYSFS_PATH_LEN,
- "/sys/block/%s", de->d_name);
- goto success;
- }
-#ifdef major
- if (major(devno) != major)
- continue;
-#endif
- }
- if (f)
- fclose(f);
-
- snprintf(path, SYSFS_PATH_LEN, "/sys/block/%s", de->d_name);
-
- if (p_dir)
- closedir(p_dir);
- if ((p_dir = opendir(path)) == NULL)
- continue;
- while ((p_de = readdir(p_dir)) != NULL) {
- if (!strcmp(p_de->d_name, ".") ||
- !strcmp(p_de->d_name, "..") ||
- (strlen(p_de->d_name) >
- SYSFS_PATH_LEN - strlen(path) - 32))
- continue;
- snprintf(p_path, SYSFS_PATH_LEN, "%s/%s/dev",
- path, p_de->d_name);
-
- f = fopen(p_path, "r");
- if (f &&
- (fscanf(f, "%u:%u", &major, &minor) == 2) &&
- (((major << 8) + minor) == devno)) {
- fclose(f);
- snprintf(ret_path, SYSFS_PATH_LEN, "%s/%s",
- path, p_de->d_name);
- goto success;
- }
- if (f)
- fclose(f);
- }
- }
- ret = NULL;
-success:
- if (dir)
- closedir(dir);
- if (p_dir)
- closedir(p_dir);
- return ret;
-}
-
-static blk64_t get_partition_start(const char *device_name)
+static blk64_t
+get_partition_start(const char *device_name EXT2FS_ATTR((unused)))
{
+#ifdef __linux__
unsigned long long start;
- sysfs_path_t path;
+ char path[128];
struct stat st;
FILE *f;
- char *cp;
int n;
if ((stat(device_name, &st) < 0) || !S_ISBLK(st.st_mode))
return 0;
- cp = search_sysfs_block(st.st_rdev, path);
- if (!cp)
- return 0;
- if (strlen(path) > SYSFS_PATH_LEN - sizeof("/start"))
- return 0;
- strcat(path, "/start");
+ sprintf(path, "/sys/dev/block/%d:%d/start",
+ major(st.st_rdev), minor(st.st_rdev));
f = fopen(path, "r");
if (!f)
return 0;
n = fscanf(f, "%llu", &start);
fclose(f);
return (n == 1) ? start : 0;
+#else
+ return 0;
+#endif
}
static errcode_t create_directory(ext2_filsys fs, char *dir,
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index bde1e582..4a9c1b09 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -1506,7 +1506,7 @@ extern const char *mke2fs_default_profile;
static const char *default_files[] = { "<default>", 0 };
struct device_param {
- unsigned long min_io; /* prefered minimum IO size */
+ unsigned long min_io; /* preferred minimum IO size */
unsigned long opt_io; /* optimal IO size */
unsigned long alignment_offset; /* alignment offset wrt physical block size */
unsigned int dax:1; /* supports dax? */
@@ -1598,7 +1598,6 @@ static void PRS(int argc, char *argv[])
* Finally, we complain about fs_blocks_count > 2^32 on a non-64bit fs.
*/
blk64_t fs_blocks_count = 0;
- long sysval;
int s_opt = -1, r_opt = -1;
char *fs_features = 0;
int fs_features_size = 0;
@@ -1632,9 +1631,12 @@ static void PRS(int argc, char *argv[])
#define _SC_PAGESIZE _SC_PAGE_SIZE
#endif
#ifdef _SC_PAGESIZE
- sysval = sysconf(_SC_PAGESIZE);
- if (sysval > 0)
- sys_page_size = sysval;
+ {
+ long sysval = sysconf(_SC_PAGESIZE);
+
+ if (sysval > 0)
+ sys_page_size = sysval;
+ }
#endif /* _SC_PAGESIZE */
#endif /* HAVE_SYSCONF */
@@ -1950,10 +1952,10 @@ profile_error:
#ifdef CONFIG_TESTIO_DEBUG
if (getenv("TEST_IO_FLAGS") || getenv("TEST_IO_BLOCK")) {
io_ptr = test_io_manager;
- test_io_backing_manager = unix_io_manager;
+ test_io_backing_manager = default_io_manager;
} else
#endif
- io_ptr = unix_io_manager;
+ io_ptr = default_io_manager;
retval = ext2fs_open(journal_device,
EXT2_FLAG_JOURNAL_DEV_OK, 0,
0, io_ptr, &jfs);
@@ -2736,7 +2738,7 @@ static int should_do_undo(const char *name)
io_channel channel;
__u16 s_magic;
struct ext2_super_block super;
- io_manager manager = unix_io_manager;
+ io_manager manager = default_io_manager;
int csum_flag, force_undo;
csum_flag = ext2fs_has_feature_metadata_csum(&fs_param) ||
@@ -3041,10 +3043,10 @@ int main (int argc, char *argv[])
#ifdef CONFIG_TESTIO_DEBUG
if (getenv("TEST_IO_FLAGS") || getenv("TEST_IO_BLOCK")) {
io_ptr = test_io_manager;
- test_io_backing_manager = unix_io_manager;
+ test_io_backing_manager = default_io_manager;
} else
#endif
- io_ptr = unix_io_manager;
+ io_ptr = default_io_manager;
if (undo_file != NULL || should_do_undo(device_name)) {
retval = mke2fs_setup_tdb(device_name, &io_ptr);
@@ -3449,7 +3451,7 @@ int main (int argc, char *argv[])
retval = ext2fs_open(journal_device, EXT2_FLAG_RW|
EXT2_FLAG_JOURNAL_DEV_OK, 0,
- fs->blocksize, unix_io_manager, &jfs);
+ fs->blocksize, default_io_manager, &jfs);
if (retval) {
com_err(program_name, retval,
_("while trying to open journal device %s\n"),
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 088f87e5..5fe22e6a 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -960,7 +960,7 @@ static void rewrite_inodes(ext2_filsys fs, unsigned int flags)
ext2fs_free_mem(&ctx.ea_buf);
}
-static void rewrite_metadata_checksums(ext2_filsys fs, unsigned int flags)
+static errcode_t rewrite_metadata_checksums(ext2_filsys fs, unsigned int flags)
{
errcode_t retval;
dgrp_t i;
@@ -975,7 +975,9 @@ static void rewrite_metadata_checksums(ext2_filsys fs, unsigned int flags)
rewrite_inodes(fs, flags);
ext2fs_mark_ib_dirty(fs);
ext2fs_mark_bb_dirty(fs);
- ext2fs_mmp_update2(fs, 1);
+ retval = ext2fs_mmp_update2(fs, 1);
+ if (retval)
+ return retval;
fs->flags &= ~EXT2_FLAG_SUPER_ONLY;
fs->flags &= ~EXT2_FLAG_IGNORE_CSUM_ERRORS;
if (ext2fs_has_feature_metadata_csum(fs->super))
@@ -983,6 +985,7 @@ static void rewrite_metadata_checksums(ext2_filsys fs, unsigned int flags)
else
fs->super->s_checksum_type = 0;
ext2fs_mark_super_dirty(fs);
+ return 0;
}
static void enable_uninit_bg(ext2_filsys fs)
@@ -3343,7 +3346,9 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
if (retval) {
com_err("tune2fs", retval,
"while recovering journal.\n");
- printf(_("Please run e2fsck -fy %s.\n"), argv[1]);
+ printf(_("Please run e2fsck -fy %s.\n"), device_name);
+ if (!fs)
+ exit(1);
rc = 1;
goto closefs;
}
@@ -3703,8 +3708,14 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
}
}
- if (rewrite_checksums)
- rewrite_metadata_checksums(fs, rewrite_checksums);
+ if (rewrite_checksums) {
+ retval = rewrite_metadata_checksums(fs, rewrite_checksums);
+ if (retval != 0) {
+ printf("Failed to rewrite metadata checksums\n");
+ rc = 1;
+ goto closefs;
+ }
+ }
if (l_flag)
list_super(sb);
@@ -3745,5 +3756,13 @@ closefs:
if (feature_64bit)
convert_64bit(fs, feature_64bit);
- return (ext2fs_close_free(&fs) ? 1 : rc);
+
+ retval = ext2fs_close_free(&fs);
+ if (retval) {
+ com_err("tune2fs", retval,
+ _("while writing out and closing file system"));
+ rc = 1;
+ }
+
+ return rc;
}
diff --git a/misc/util.c b/misc/util.c
index e84ebab5..3e83169f 100644
--- a/misc/util.c
+++ b/misc/util.c
@@ -16,6 +16,11 @@
#define _LARGEFILE64_SOURCE
#endif
+#ifdef _WIN32
+#define _POSIX
+#define __USE_MINGW_ALARM
+#endif
+
#include "config.h"
#include <fcntl.h>
#include <setjmp.h>
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index 243cd777..5eeb7d44 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -1116,7 +1116,6 @@ static errcode_t adjust_superblock(ext2_resize_t rfs, blk64_t new_size)
ext2_filsys fs = rfs->new_fs;
int adj = 0;
errcode_t retval;
- blk64_t group_block;
unsigned long i;
unsigned long max_group;
@@ -1181,8 +1180,6 @@ static errcode_t adjust_superblock(ext2_resize_t rfs, blk64_t new_size)
goto errout;
memset(rfs->itable_buf, 0, fs->blocksize * fs->inode_blocks_per_group);
- group_block = ext2fs_group_first_block2(fs,
- rfs->old_fs->group_desc_count);
adj = rfs->old_fs->group_desc_count;
max_group = fs->group_desc_count - adj;
if (rfs->progress) {
@@ -1209,7 +1206,6 @@ static errcode_t adjust_superblock(ext2_resize_t rfs, blk64_t new_size)
if (retval)
goto errout;
}
- group_block += fs->super->s_blocks_per_group;
}
io_channel_flush(fs->io);
retval = 0;
diff --git a/scrub/e2scrub.8.in b/scrub/e2scrub.8.in
index cfc23318..3d277511 100644
--- a/scrub/e2scrub.8.in
+++ b/scrub/e2scrub.8.in
@@ -1,7 +1,7 @@
.TH E2SCRUB 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
.SH NAME
e2scrub - check the contents of a mounted ext[234] file system
-.SH SYNOPSYS
+.SH SYNOPSIS
.B
e2scrub [OPTION] MOUNTPOINT | DEVICE
.SH DESCRIPTION
diff --git a/scrub/e2scrub.in b/scrub/e2scrub.in
index 30ab7cbd..7ed57f2d 100644
--- a/scrub/e2scrub.in
+++ b/scrub/e2scrub.in
@@ -164,7 +164,7 @@ lvm_vars="$(lvs --nameprefixes -o name,vgname,lv_role --noheadings "${dev}" 2> /
eval "${lvm_vars}"
if [ -z "${LVM2_VG_NAME}" ] || [ -z "${LVM2_LV_NAME}" ] ||
echo "${LVM2_LV_ROLE}" | grep -q "snapshot"; then
- echo "${arg}: Not connnected to an LVM logical volume."
+ echo "${arg}: Not connected to an LVM logical volume."
print_help
exitcode 16
fi
diff --git a/scrub/e2scrub_all.8.in b/scrub/e2scrub_all.8.in
index c33c18f6..99bdc0d4 100644
--- a/scrub/e2scrub_all.8.in
+++ b/scrub/e2scrub_all.8.in
@@ -1,7 +1,7 @@
.TH E2SCRUB 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
.SH NAME
e2scrub_all - check all mounted ext[234] file systems for errors.
-.SH SYNOPSYS
+.SH SYNOPSIS
.B
e2scrub_all [OPTION]
.SH DESCRIPTION
diff --git a/tests/README b/tests/README
index d075db57..d9d24376 100644
--- a/tests/README
+++ b/tests/README
@@ -31,7 +31,7 @@ filesystems against the original e2fsck, you will have to inspect the
test_script.log file manually.
--------------------------------------------------------------
-Here's a one-line descriptons of the various test images in this
+Here's a one-line descriptions of the various test images in this
directory:
baddir.img Filesystem with a corrupted directory
diff --git a/tests/f_badjour_encrypted/expect.1 b/tests/f_badjour_encrypted/expect.1
new file mode 100644
index 00000000..0b13b9eb
--- /dev/null
+++ b/tests/f_badjour_encrypted/expect.1
@@ -0,0 +1,30 @@
+Superblock has an invalid journal (inode 8).
+Clear? yes
+
+*** journal has been deleted ***
+
+Pass 1: Checking inodes, blocks, and sizes
+Journal inode is not in use, but contains data. Clear? yes
+
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Block bitmap differences: -(24--25) -(27--41) -(107--1113)
+Fix? yes
+
+Free blocks count wrong for group #0 (934, counted=1958).
+Fix? yes
+
+Free blocks count wrong (934, counted=1958).
+Fix? yes
+
+Recreate journal? yes
+
+Creating journal (1024 blocks): Done.
+
+*** journal has been regenerated ***
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 11/256 files (0.0% non-contiguous), 1114/2048 blocks
+Exit status is 1
diff --git a/tests/f_badjour_encrypted/expect.2 b/tests/f_badjour_encrypted/expect.2
new file mode 100644
index 00000000..76934be2
--- /dev/null
+++ b/tests/f_badjour_encrypted/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/256 files (9.1% non-contiguous), 1114/2048 blocks
+Exit status is 0
diff --git a/tests/f_badjour_encrypted/name b/tests/f_badjour_encrypted/name
new file mode 100644
index 00000000..e8f4c04f
--- /dev/null
+++ b/tests/f_badjour_encrypted/name
@@ -0,0 +1 @@
+journal inode has encrypt flag
diff --git a/tests/f_badjour_encrypted/script b/tests/f_badjour_encrypted/script
new file mode 100644
index 00000000..e6778f1d
--- /dev/null
+++ b/tests/f_badjour_encrypted/script
@@ -0,0 +1,11 @@
+if ! test -x $DEBUGFS_EXE; then
+ echo "$test_name: $test_description: skipped (no debugfs)"
+ return 0
+fi
+
+touch $TMPFILE
+$MKE2FS -t ext4 -b 1024 $TMPFILE 2M
+$DEBUGFS -w -R 'set_inode_field <8> flags 0x80800' $TMPFILE
+
+SKIP_GUNZIP="true"
+. $cmd_dir/run_e2fsck
diff --git a/tests/f_dup_resize/expect.1 b/tests/f_dup_resize/expect.1
index e0d86979..8a2764d3 100644
--- a/tests/f_dup_resize/expect.1
+++ b/tests/f_dup_resize/expect.1
@@ -11,7 +11,8 @@ Pass 1D: Reconciling multiply-claimed blocks
(There are 1 inodes containing multiply-claimed blocks.)
File /debugfs (inode #12, mod time Mon Apr 11 00:00:00 2005)
- has 4 multiply-claimed block(s), shared with 1 file(s):
+ has 4 multiply-claimed block(s), shared with 2 file(s):
+ <filesystem metadata>
<The group descriptor inode> (inode #7, mod time Mon Apr 11 06:13:20 2005)
Clone multiply-claimed blocks? yes
diff --git a/util/android_config.h b/util/android_config.h
index 6ac16fec..90b8f8a8 100644
--- a/util/android_config.h
+++ b/util/android_config.h
@@ -36,7 +36,6 @@
#if defined(_WIN32)
# define HAVE_LINUX_TYPES_H 1
-# define HAVE_WINSOCK_H 1
#endif
#if defined(__APPLE__) || defined(__linux__)
# define HAVE_FCNTL 1
diff --git a/util/mkutf8data.c b/util/mkutf8data.c
index 49bb0e16..2af25acf 100644
--- a/util/mkutf8data.c
+++ b/util/mkutf8data.c
@@ -3003,7 +3003,7 @@ int utf8cursor(struct utf8cursor *u8c, struct tree *tree, const char *s)
/*
* Get one byte from the normalized form of the string described by u8c.
*
- * Returns the byte cast to an unsigned char on succes, and -1 on failure.
+ * Returns the byte cast to an unsigned char on success, and -1 on failure.
*
* The cursor keeps track of the location in the string in u8c->s.
* When a character is decomposed, the current location is stored in
diff --git a/util/subst.c b/util/subst.c
index c0eda5cf..be2a0dda 100644
--- a/util/subst.c
+++ b/util/subst.c
@@ -434,7 +434,7 @@ int main(int argc, char **argv)
printf("Using original atime\n");
set_utimes(outfn, fileno(old), tv);
}
-#ifndef _WIN64
+#ifndef _WIN32
if (ofd >= 0)
(void) fchmod(ofd, 0444);
#endif
@@ -444,7 +444,7 @@ int main(int argc, char **argv)
} else {
if (verbose)
printf("Creating or replacing %s.\n", outfn);
-#ifndef _WIN64
+#ifndef _WIN32
if (ofd >= 0)
(void) fchmod(ofd, 0444);
#endif