[PATCH xserver 3/4] xfree86: replace all uses of xf86PrivsElevated with PrivsElevated

Nicolai Hähnle nhaehnle at gmail.com
Fri Jan 27 13:37:37 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

Signed-off-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
 hw/xfree86/common/xf86Config.c |  2 +-
 hw/xfree86/common/xf86Init.c   | 12 +++---------
 hw/xfree86/common/xf86Priv.h   |  2 --
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index f03acf3..5d2cf0a 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -2309,21 +2309,21 @@ xf86HandleConfigFile(Bool autoconfig)
     Bool singlecard = 0;
     Bool implicit_layout = FALSE;
     XF86ConfLayoutPtr layout;
 
     if (!autoconfig) {
         char *filename, *dirname, *sysdirname;
         const char *filesearch, *dirsearch;
         MessageType filefrom = X_DEFAULT;
         MessageType dirfrom = X_DEFAULT;
 
-        if (!xf86PrivsElevated()) {
+        if (!PrivsElevated()) {
             filesearch = ALL_CONFIGPATH;
             dirsearch = ALL_CONFIGDIRPATH;
         }
         else {
             filesearch = RESTRICTED_CONFIGPATH;
             dirsearch = RESTRICTED_CONFIGDIRPATH;
         }
 
         if (xf86ConfigFile)
             filefrom = X_CMDLINE;
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 758b926..deed91f 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -227,26 +227,20 @@ xf86PrintBanner(void)
 #if defined(BUILDERSTRING)
     xf86ErrorFVerb(0, "%s \n", BUILDERSTRING);
 #endif
     xf86ErrorFVerb(0, "Current version of pixman: %s\n",
                    pixman_version_string());
     xf86ErrorFVerb(0, "\tBefore reporting problems, check "
                    "" __VENDORDWEBSUPPORT__ "\n"
                    "\tto make sure that you have the latest version.\n");
 }
 
-Bool
-xf86PrivsElevated(void)
-{
-    return PrivsElevated();
-}
-
 static void
 InstallSignalHandlers(void)
 {
     /*
      * Install signal handler for unexpected signals
      */
     xf86Info.caughtSignal = FALSE;
     if (!xf86Info.notrapSignals) {
         OsRegisterSigWrapper(xf86SigWrapper);
     }
@@ -886,21 +880,21 @@ OsVendorInit(void)
     /* Set stderr to non-blocking. */
 #ifndef O_NONBLOCK
 #if defined(FNDELAY)
 #define O_NONBLOCK FNDELAY
 #elif defined(O_NDELAY)
 #define O_NONBLOCK O_NDELAY
 #endif
 
 #ifdef O_NONBLOCK
     if (!beenHere) {
-        if (xf86PrivsElevated()) {
+        if (PrivsElevated()) {
             int status;
 
             status = fcntl(fileno(stderr), F_GETFL, 0);
             if (status != -1) {
                 fcntl(fileno(stderr), F_SETFL, status | O_NONBLOCK);
             }
         }
     }
 #endif
 #endif
@@ -1041,21 +1035,21 @@ xf86PrintDefaultModulePath(void)
 
 static void
 xf86PrintDefaultLibraryPath(void)
 {
     ErrorF("%s\n", DEFAULT_LIBRARY_PATH);
 }
 
 static void
 xf86CheckPrivs(const char *option, const char *arg)
 {
-    if (xf86PrivsElevated() && !xf86PathIsSafe(arg)) {
+    if (PrivsElevated() && !xf86PathIsSafe(arg)) {
         FatalError("\nInvalid argument for %s - \"%s\"\n"
                     "\tWith elevated privileges %s must specify a relative path\n"
                     "\twithout any \"..\" elements.\n\n", option, arg, option);
     }
 }
 
 /*
  * ddxProcessArgument --
  *	Process device-dependent command line args. Returns 0 if argument is
  *      not device dependent, otherwise Count of number of elements of argv
@@ -1342,21 +1336,21 @@ ddxProcessArgument(int argc, char **argv, int i)
  *	Print out correct use of device dependent commandline options.
  *      Maybe the user now knows what really to do ...
  */
 
 void
 ddxUseMsg(void)
 {
     ErrorF("\n");
     ErrorF("\n");
     ErrorF("Device Dependent Usage\n");
-    if (!xf86PrivsElevated()) {
+    if (!PrivsElevated()) {
         ErrorF("-modulepath paths      specify the module search path\n");
         ErrorF("-logfile file          specify a log file name\n");
         ErrorF("-configure             probe for devices and write an "
                __XCONFIGFILE__ "\n");
         ErrorF
             ("-showopts              print available options for all installed drivers\n");
     }
     ErrorF
         ("-config file           specify a configuration file, relative to the\n");
     ErrorF("                       " __XCONFIGFILE__
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index c1f8a18..d78e8f6 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -154,16 +154,14 @@ xf86CloseLog(enum ExitCode error);
 
 /* xf86Init.c */
 extern _X_EXPORT Bool
 xf86LoadModules(const char **list, void **optlist);
 extern _X_EXPORT int
 xf86SetVerbosity(int verb);
 extern _X_EXPORT int
 xf86SetLogVerbosity(int verb);
 extern _X_EXPORT Bool
 xf86CallDriverProbe(struct _DriverRec *drv, Bool detect_only);
-extern _X_EXPORT Bool
-xf86PrivsElevated(void);
 
 #endif                          /* _NO_XF86_PROTOTYPES */
 
 #endif                          /* _XF86PRIV_H */
-- 
2.7.4



More information about the xorg-devel mailing list