mknod: be more vocal about danger of running tests as root
authorEric Blake <eblake@redhat.com>
Fri, 30 Jul 2010 23:29:43 +0000 (17:29 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 9 Aug 2010 17:53:01 +0000 (11:53 -0600)
* 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>
ChangeLog
m4/mknod.m4

index 2e71438..e1a70c8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
index 4d9214d..c13644b 100644 (file)
@@ -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