]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Don't assume that the presence of mntent.h means that setmntent() exists
authorTheodore Ts'o <tytso@mit.edu>
Thu, 5 Apr 2012 22:31:09 +0000 (15:31 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 5 Apr 2012 22:31:09 +0000 (15:31 -0700)
Change autoconf to test for setmntent() and use that to decide whether
to use getmntent() and setmntent(), since some systems don't have
setmntent() but they do have the mntent.h header file.

Also, remove the includes of mntent.h from e2fsck and mke2fs and other
places where it is not needed.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
configure
configure.in
e2fsck/iscan.c
e2fsck/scantest.c
e2fsck/unix.c
lib/config.h.in
lib/ext2fs/ismounted.c
misc/ismounted.c
misc/mke2fs.c

index aae5e602a8e700e14d279407d2b648b8d73f8947..ac0426e8901cd57778432ec7de4572bac7570951 100755 (executable)
--- a/configure
+++ b/configure
@@ -10893,7 +10893,7 @@ if test "$ac_res" != no; then :
 fi
 
 fi
-for ac_func in         __secure_getenv         backtrace       blkid_probe_get_topology        chflags         fallocate       fallocate64     fchown  fdatasync       fstat64         ftruncate64     getdtablesize   getmntinfo      getpwuid_r      getrlimit       getrusage       jrand48         llseek  lseek64         mallinfo        mbstowcs        memalign        mmap    msync   nanosleep       open64  pathconf        posix_fadvise   posix_memalign  prctl   quotactl        setresgid       setresuid       srandom         strcasecmp      strdup  strnlen         strptime        strtoull        sync_file_range         sysconf         usleep  utime   valloc
+for ac_func in         __secure_getenv         backtrace       blkid_probe_get_topology        chflags         fallocate       fallocate64     fchown  fdatasync       fstat64         ftruncate64     getdtablesize   getmntinfo      getpwuid_r      getrlimit       getrusage       jrand48         llseek  lseek64         mallinfo        mbstowcs        memalign        mmap    msync   nanosleep       open64  pathconf        posix_fadvise   posix_memalign  prctl   quotactl        setmntent       setresgid       setresuid       srandom         strcasecmp      strdup  strnlen         strptime        strtoull        sync_file_range         sysconf         usleep  utime   valloc
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
index e458a7d68b137fc417e84565932b0dfd5d0e0531..e15a77a6dbaf1fc8c3f846938909126f9a32b705 100644 (file)
@@ -986,6 +986,7 @@ AC_CHECK_FUNCS(m4_flatten([
        posix_memalign
        prctl
        quotactl
+       setmntent
        setresgid
        setresuid
        srandom
index f5286b74f383166cec97b764c2336a408dec9e24..e23d2ad550dc8d5ea05d8b4f03cefff7fdc72957 100644 (file)
@@ -16,9 +16,6 @@
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
 #endif
-#ifdef HAVE_MNTENT_H
-#include <mntent.h>
-#endif
 #include <sys/ioctl.h>
 #ifdef HAVE_MALLOC_H
 #include <malloc.h>
index 852ff86b1cde9a167cfd545a17fa09bdde4a19db..16380b313ace9fdf631fe79f83eb2aa59d2d3ebe 100644 (file)
@@ -12,9 +12,6 @@
 #include <getopt.h>
 #endif
 #include <unistd.h>
-#ifdef HAVE_MNTENT_H
-#include <mntent.h>
-#endif
 #include <sys/ioctl.h>
 #ifdef HAVE_MALLOC_H
 #include <malloc.h>
index 63d1c6575622914a081e3329bbe76a8384c9ecb3..fdefe7a3bb11c8b21d116bcff61da82274e17adb 100644 (file)
@@ -33,9 +33,6 @@ extern int optind;
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
 #endif
-#ifdef HAVE_MNTENT_H
-#include <mntent.h>
-#endif
 #ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
 #endif
index bd57a471bcc2c28ec016ca47e6337948f899e168..18539c6ca81b9d7b4a94fd48e2798c5d2e6a87a1 100644 (file)
 /* Define to 1 if you have the `setlocale' function. */
 #undef HAVE_SETLOCALE
 
+/* Define to 1 if you have the `setmntent' function. */
+#undef HAVE_SETMNTENT
+
 /* Define to 1 if you have the `setresgid' function. */
 #undef HAVE_SETRESGID
 
index 823eb3feb995d17720654cc745540282e8d4fc81..bf532ae0428b33c6f88a6f1d63a283ac9e2c68ac 100644 (file)
@@ -35,7 +35,7 @@
 #include "ext2_fs.h"
 #include "ext2fs.h"
 
-#ifdef HAVE_MNTENT_H
+#ifdef HAVE_SETMNTENT
 /*
  * Helper function which checks a file in /etc/mtab format to see if a
  * filesystem is mounted.  Returns an error if the file doesn't exist
@@ -231,7 +231,7 @@ static errcode_t check_getmntinfo(const char *file, int *mount_flags,
        return 0;
 }
 #endif /* HAVE_GETMNTINFO */
-#endif /* HAVE_MNTENT_H */
+#endif /* HAVE_SETMNTENT */
 
 /*
  * Check to see if we're dealing with the swap device.
@@ -310,7 +310,7 @@ errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags,
                *mount_flags = EXT2_MF_MOUNTED | EXT2_MF_SWAP;
                strncpy(mtpt, "<swap>", mtlen);
        } else {
-#ifdef HAVE_MNTENT_H
+#ifdef HAVE_SETMNTENT
                retval = check_mntent(device, mount_flags, mtpt, mtlen);
 #else
 #ifdef HAVE_GETMNTINFO
@@ -321,7 +321,7 @@ errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags,
 #endif
                *mount_flags = 0;
 #endif /* HAVE_GETMNTINFO */
-#endif /* HAVE_MNTENT_H */
+#endif /* HAVE_SETMNTENT */
        }
        if (retval)
                return retval;
index 9e8bebfd710181974ec32c8e48b290dc3020358a..4671af8e6e1a39d990a86efe5bd239cb923827a9 100644 (file)
@@ -78,7 +78,7 @@ static char *parse_word(char **buf)
 static errcode_t check_mntent_file(const char *mtab_file, const char *file,
                                   int *mount_flags)
 {
-#ifdef HAVE_MNTENT_H
+#ifdef HAVE_SETMNTENT
        struct stat     st_buf;
        errcode_t       retval = 0;
        dev_t           file_dev=0, file_rdev=0;
@@ -178,7 +178,7 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file,
 errout:
        endmntent (f);
        return retval;
-#else /* !HAVE_MNTENT_H */
+#else /* !HAVE_SETMNTENT */
        return 0;
 #endif /* HAVE_MNTENT_H */
 }
index 60389d44147ae2f85f034759d348a95964bbce84..7ec8cc2f3cef6c2602030f03269bf390fb9d1d5e 100644 (file)
@@ -43,9 +43,6 @@ extern int optind;
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
 #endif
-#ifdef HAVE_MNTENT_H
-#include <mntent.h>
-#endif
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <sys/stat.h>