changeset 33231:1245570e456f

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. Suggested by Bruno Haible, based on a report by Rainer Tammer. Signed-off-by: Eric Blake <eblake@redhat.com>
author Eric Blake <eblake@redhat.com>
date Fri, 30 Jul 2010 17:29:43 -0600
parents b9cc0f197895
children 5308c67ed594
files ChangeLog m4/mknod.m4
diffstat 2 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Aug 09 11:16:07 2010 -0600
+++ b/ChangeLog	Fri Jul 30 17:29:43 2010 -0600
@@ -1,5 +1,10 @@
 2010-08-09  Eric Blake  <eblake@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.
+	Suggested by Bruno Haible, based on a report by Rainer Tammer.
+
 	readlinkat: split into its own module
 	* modules/symlinkat: Split readlinkat...
 	* modules/readlinkat: ...into separate module.
--- a/m4/mknod.m4	Mon Aug 09 11:16:07 2010 -0600
+++ b/m4/mknod.m4	Fri Jul 30 17:29:43 2010 -0600
@@ -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 @@
              #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