summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2008-12-02 13:32:34 -0800
committerAlan Coopersmith <alan.coopersmith@sun.com>2008-12-02 13:35:03 -0800
commit8561514574b3540c729bcc3acca9c943adcdc778 (patch)
tree44dc51d33aa743436afcefd3afa8524d38cff47c /hw
parent6de6ffff35ac03d49fa61de195d4a0605e0ef8bf (diff)
Don't need to check uid/euid for every commandline argument
Check uid/euid only when handling the arguments that are restricted to root/non-setuid users
Diffstat (limited to 'hw')
-rw-r--r--hw/xfree86/common/xf86Init.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 01acb8e4f..e8095e5d5 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1535,9 +1535,11 @@ ddxProcessArgument(int argc, char **argv, int i)
}
/* First the options that are only allowed for root */
- if (getuid() == 0 || geteuid() != 0)
- {
- if (!strcmp(argv[i], "-modulepath"))
+ 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]);
+ }
+ else if (!strcmp(argv[i], "-modulepath"))
{
char *mp;
CHECK_FOR_REQUIRED_ARGUMENT();
@@ -1561,8 +1563,6 @@ ddxProcessArgument(int argc, char **argv, int i)
xf86LogFileFrom = X_CMDLINE;
return 2;
}
- } else if (!strcmp(argv[i], "-modulepath") || !strcmp(argv[i], "-logfile")) {
- FatalError("The '%s' option can only be used by root.\n", argv[i]);
}
if (!strcmp(argv[i], "-config") || !strcmp(argv[i], "-xf86config"))
{