--- xfree86/common/xf86Init.c 2011-08-05 13:00:12.000000000 +0700 +++ xfree86.euid/common/xf86Init.c 2011-09-30 12:11:37.028783141 +0700 @@ -1052,8 +1052,8 @@ /* First the options that are only allowed for root */ if (!strcmp(argv[i], "-modulepath") || !strcmp(argv[i], "-logfile")) { - if ( (geteuid() == 0) && (getuid() != 0) ) { - FatalError("The '%s' option can only be used by root.\n", argv[i]); + if ( (geteuid() != getuid()) ) { + FatalError("The '%s' option cannot be used when running with elevated privileges.\n", argv[i]); } else if (!strcmp(argv[i], "-modulepath")) { @@ -1081,9 +1081,9 @@ if (!strcmp(argv[i], "-config") || !strcmp(argv[i], "-xf86config")) { CHECK_FOR_REQUIRED_ARGUMENT(); - if (getuid() != 0 && !xf86PathIsSafe(argv[i + 1])) { + if (getuid() != geteuid() && !xf86PathIsSafe(argv[i + 1])) { FatalError("\nInvalid argument for %s\n" - "\tFor non-root users, the file specified with %s must be\n" + "\tWith elevated privileges, the file specified with %s must be\n" "\ta relative path and must not contain any \"..\" elements.\n" "\tUsing default "__XCONFIGFILE__" search path.\n\n", argv[i], argv[i]); @@ -1094,9 +1094,9 @@ if (!strcmp(argv[i], "-configdir")) { CHECK_FOR_REQUIRED_ARGUMENT(); - if (getuid() != 0 && !xf86PathIsSafe(argv[i + 1])) { + if (getuid() != geteuid() && !xf86PathIsSafe(argv[i + 1])) { FatalError("\nInvalid argument for %s\n" - "\tFor non-root users, the file specified with %s must be\n" + "\tWith elevated privileges, the file specified with %s must be\n" "\ta relative path and must not contain any \"..\" elements.\n" "\tUsing default "__XCONFIGDIR__" search path.\n\n", argv[i], argv[i]); @@ -1372,11 +1372,11 @@ ErrorF("Device Dependent Usage\n"); if (getuid() == 0 || geteuid() != 0) { - 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("-modulepath paths specify the module search path\n"); + ErrorF("-logfile file specify a log file name\n"); ErrorF("-config file specify a configuration file, relative to the\n"); ErrorF(" "__XCONFIGFILE__" search path, only root can use absolute\n"); ErrorF("-configdir dir specify a configuration directory, relative to the\n");