From 162cf21acadd9f58e014c45b1f29d63c6f80c91a Mon Sep 17 00:00:00 2001 From: Olaf Seibert Date: Mon, 25 Jan 2016 22:43:45 +0100 Subject: [PATCH] Changed the check for superuser from error to warning. The check is done so early that we can't reasonably know yet if we really need to be root. For VDE, root is unneeded, but for the other interface methods it is. --- configure.ac | 3 ++- src/dpimp.c | 7 ++++--- src/dpni20.c | 7 ++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 47cad63..3867664 100644 --- a/configure.ac +++ b/configure.ac @@ -103,7 +103,8 @@ AC_FUNC_REALLOC AC_CHECK_FUNCS([alarm dup2 gettimeofday localtime_r memset socket strcasecmp \ strchr strcspn strerror strncasecmp strpbrk strrchr strtol \ getifaddrs if_nameindex sigaction nanosleep \ - gettimeofday getrusage setitimer tcsetattr mlockall]) + gettimeofday getrusage setitimer tcsetattr mlockall \ + setpriority]) # Check for CPU. # This requires install-sh, config.sub, config.guess from automake. diff --git a/src/dpimp.c b/src/dpimp.c index 10c6a07..544ffbb 100644 --- a/src/dpimp.c +++ b/src/dpimp.c @@ -434,7 +434,7 @@ main(int argc, char **argv) ** we can, since a slow response will cause the 10 monitor to declare ** the interface dead. */ -#if CENV_SYS_SOLARIS || CENV_SYS_DECOSF || CENV_SYS_XBSD || CENV_SYS_LINUX +#if HAVE_SETPRIORITY if (setpriority(PRIO_PROCESS, 0, -20) < 0) syserr(errno, "Warning - cannot set high priority"); #elif CENV_SYS_UNIX /* Try old generic Unix call */ @@ -455,8 +455,9 @@ main(int argc, char **argv) dbprint("Started"); /* General initialization */ - if (geteuid() != 0) - efatal(1, "Must be superuser!"); + if (geteuid() != 0) { + error("*** Must usually run as superuser; networking may fail! ***"); + } if (!dp_main(&dp, argc, argv)) { efatal(1, "DP init failed!"); diff --git a/src/dpni20.c b/src/dpni20.c index 149fc2f..cb09fcd 100644 --- a/src/dpni20.c +++ b/src/dpni20.c @@ -320,7 +320,7 @@ main(int argc, char **argv) #if 0 /* was CENV_SYS_SOLARIS */ if (nice(-20) == -1) syserr(errno, "Warning - cannot set high priority"); -#elif CENV_SYS_SOLARIS || CENV_SYS_DECOSF || CENV_SYS_XBSD || CENV_SYS_LINUX +#elif HAVE_SETPRIORITY if (setpriority(PRIO_PROCESS, 0, -20) < 0) syserr(errno, "Warning - cannot set high priority"); #endif @@ -336,8 +336,9 @@ main(int argc, char **argv) dbprint("Started"); /* General initialization */ - if (geteuid() != 0) - efatal(1, "Must be superuser!"); + if (geteuid() != 0) { + error("*** Must usually run as superuser; networking may fail! ***"); + } if (!dp_main(&dp, argc, argv)) { efatal(1, "DP init failed!");