From ca57057f598bfc7119f79f71bf38ec88244ab396 Mon Sep 17 00:00:00 2001 From: Cy Schubert Date: Wed, 31 Aug 2016 00:08:49 +0000 Subject: Import am-utils 6.2, Suggested by: pfg@ Obtained from: ftp://ftp.am-utils.org/pub/am-utils/ --- m4/macros/func_bad_hasmntopt.m4 | 59 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 m4/macros/func_bad_hasmntopt.m4 (limited to 'm4/macros/func_bad_hasmntopt.m4') 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 before is included */ +# ifdef HAVE_STDIO_H +# include +# endif /* HAVE_STDIO_H */ +# include +#endif /* HAVE_MNTENT_H */ +#ifdef HAVE_SYS_MNTENT_H +# include +#endif /* HAVE_SYS_MNTENT_H */ +#ifdef HAVE_SYS_MNTTAB_H +# include +#endif /* HAVE_SYS_MNTTAB_H */ +#if defined(HAVE_MNTTAB_H) && !defined(MNTTAB) +# include +#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 +]) -- cgit v1.2.3