aboutsummaryrefslogtreecommitdiffstats
path: root/m4/macros/func_bad_hasmntopt.m4
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2016-08-31 00:08:49 +0000
committerCy Schubert <cy@FreeBSD.org>2016-08-31 00:08:49 +0000
commitca57057f598bfc7119f79f71bf38ec88244ab396 (patch)
tree051f78ef258707b493cc7cb21569b6949915f6c7 /m4/macros/func_bad_hasmntopt.m4
parente66b16bf080ead1c51f321eaf56710c771778706 (diff)
downloadsrc-ca57057f598bfc7119f79f71bf38ec88244ab396.tar.gz
src-ca57057f598bfc7119f79f71bf38ec88244ab396.zip
Import am-utils 6.2,vendor/amd/6.2vendor/amd
Suggested by: pfg@ Obtained from: ftp://ftp.am-utils.org/pub/am-utils/
Notes
Notes: svn path=/vendor/amd/dist/; revision=305100 svn path=/vendor/amd/6.2/; revision=305101; tag=vendor/amd/6.2
Diffstat (limited to 'm4/macros/func_bad_hasmntopt.m4')
-rw-r--r--m4/macros/func_bad_hasmntopt.m459
1 files changed, 59 insertions, 0 deletions
diff --git a/m4/macros/func_bad_hasmntopt.m4 b/m4/macros/func_bad_hasmntopt.m4
new file mode 100644
index 000000000000..d458bd30c4c0
--- /dev/null
+++ b/m4/macros/func_bad_hasmntopt.m4
@@ -0,0 +1,59 @@
+dnl ######################################################################
+dnl Check if we have as buggy hasmntopt() libc function
+AC_DEFUN([AMU_FUNC_BAD_HASMNTOPT],
+[
+AC_CACHE_CHECK([for working hasmntopt], ac_cv_func_hasmntopt_working,
+[AC_TRY_RUN(
+AMU_MOUNT_HEADERS(
+[[
+#ifdef HAVE_MNTENT_H
+/* some systems need <stdio.h> before <mntent.h> is included */
+# ifdef HAVE_STDIO_H
+# include <stdio.h>
+# endif /* HAVE_STDIO_H */
+# include <mntent.h>
+#endif /* HAVE_MNTENT_H */
+#ifdef HAVE_SYS_MNTENT_H
+# include <sys/mntent.h>
+#endif /* HAVE_SYS_MNTENT_H */
+#ifdef HAVE_SYS_MNTTAB_H
+# include <sys/mnttab.h>
+#endif /* HAVE_SYS_MNTTAB_H */
+#if defined(HAVE_MNTTAB_H) && !defined(MNTTAB)
+# include <mnttab.h>
+#endif /* defined(HAVE_MNTTAB_H) && !defined(MNTTAB) */
+#ifdef HAVE_STRUCT_MNTENT
+typedef struct mntent mntent_t;
+#else /* not HAVE_STRUCT_MNTENT */
+# ifdef HAVE_STRUCT_MNTTAB
+typedef struct mnttab mntent_t;
+/* map struct mnttab field names to struct mntent field names */
+# define mnt_opts mnt_mntopts
+# endif /* not HAVE_STRUCT_MNTTAB */
+#endif /* not HAVE_STRUCT_MNTENT */
+
+int main()
+{
+ mntent_t mnt;
+ char *tmp = NULL;
+
+ /*
+ * Test if hasmntopt will incorrectly find the string "soft", which
+ * is part of the large "softlookup" function.
+ */
+ mnt.mnt_opts = "hard,softlookup,ro";
+
+ if ((tmp = hasmntopt(&mnt, "soft")))
+ exit(1);
+ exit(0);
+}
+]]),
+ [ac_cv_func_hasmntopt_working=yes],
+ [ac_cv_func_hasmntopt_working=no]
+)])
+if test $ac_cv_func_hasmntopt_working = no
+then
+ AC_LIBOBJ([hasmntopt])
+ AC_DEFINE(HAVE_BAD_HASMNTOPT)
+fi
+])