* m4/mknod.m4 (gl_FUNC_MKNOD): Make it harder to run configure as root, since that is just asking for problems. Based on a report by Bruno Haible.
Signed-off-by: Eric Blake <ebl...@redhat.com> --- What do you think of this? ChangeLog | 7 +++++++ m4/mknod.m4 | 11 ++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7158e92..f6c1b1e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-07-30 Eric Blake <ebl...@redhat.com> + + mknod: be more vocal about danger of running tests as root + * m4/mknod.m4 (gl_FUNC_MKNOD): Make it harder to run configure as + root, since that is just asking for problems. + Based on a report by Bruno Haible. + 2010-02-17 Eric Blake <e...@byu.net> manywarnings: add more warnings diff --git a/m4/mknod.m4 b/m4/mknod.m4 index 4d9214d..c13644b 100644 --- a/m4/mknod.m4 +++ b/m4/mknod.m4 @@ -1,4 +1,4 @@ -# serial 1 +# serial 2 # See if we need to provide mknod replacement. dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc. @@ -27,9 +27,14 @@ AC_DEFUN([gl_FUNC_MKNOD], #include <unistd.h> ]], [[/* Indeterminate for super-user, assume no. Why are you running configure as root, anyway? */ - if (!geteuid ()) return 1; + if (!geteuid ()) return 99; if (mknod ("conftest.fifo", S_IFIFO | 0600, 0)) return 2;]])], - [gl_cv_func_mknod_works=yes], [gl_cv_func_mknod_works=no], + [gl_cv_func_mknod_works=yes], + [if test $? == 99 && test x"$FORCE_UNSAFE_CONFIGURE" = x; then + AC_MSG_FAILURE([you should not run configure as root ]dnl +[(set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)]) + fi + gl_cv_func_mknod_works=no], [gl_cv_func_mknod_works="guessing no"]) rm -f conftest.fifo]) if test "$gl_cv_func_mknod_works" != yes; then -- 1.7.2