xfree86: use the xf86CheckPrivs() helper for modulepath/logfile
v2: Rebase against updated xf86CheckPrivs() helper. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
parent
0fdd475604
commit
032b1d79b7
|
@ -1120,33 +1120,29 @@ ddxProcessArgument(int argc, char **argv, int i)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* First the options that are not allowed with elevated privileges */
|
/* First the options that are not allowed with elevated privileges */
|
||||||
if (!strcmp(argv[i], "-modulepath") || !strcmp(argv[i], "-logfile")) {
|
if (!strcmp(argv[i], "-modulepath")) {
|
||||||
if (xf86PrivsElevated()) {
|
char *mp;
|
||||||
FatalError("The '%s' option cannot be used with "
|
|
||||||
"elevated privileges.\n", argv[i]);
|
|
||||||
}
|
|
||||||
else if (!strcmp(argv[i], "-modulepath")) {
|
|
||||||
char *mp;
|
|
||||||
|
|
||||||
CHECK_FOR_REQUIRED_ARGUMENT();
|
CHECK_FOR_REQUIRED_ARGUMENT();
|
||||||
mp = strdup(argv[i + 1]);
|
xf86CheckPrivs(argv[i], argv[i + 1]);
|
||||||
if (!mp)
|
mp = strdup(argv[i + 1]);
|
||||||
FatalError("Can't allocate memory for ModulePath\n");
|
if (!mp)
|
||||||
xf86ModulePath = mp;
|
FatalError("Can't allocate memory for ModulePath\n");
|
||||||
xf86ModPathFrom = X_CMDLINE;
|
xf86ModulePath = mp;
|
||||||
return 2;
|
xf86ModPathFrom = X_CMDLINE;
|
||||||
}
|
return 2;
|
||||||
else if (!strcmp(argv[i], "-logfile")) {
|
}
|
||||||
char *lf;
|
if (!strcmp(argv[i], "-logfile")) {
|
||||||
|
char *lf;
|
||||||
|
|
||||||
CHECK_FOR_REQUIRED_ARGUMENT();
|
CHECK_FOR_REQUIRED_ARGUMENT();
|
||||||
lf = strdup(argv[i + 1]);
|
xf86CheckPrivs(argv[i], argv[i + 1]);
|
||||||
if (!lf)
|
lf = strdup(argv[i + 1]);
|
||||||
FatalError("Can't allocate memory for LogFile\n");
|
if (!lf)
|
||||||
xf86LogFile = lf;
|
FatalError("Can't allocate memory for LogFile\n");
|
||||||
xf86LogFileFrom = X_CMDLINE;
|
xf86LogFile = lf;
|
||||||
return 2;
|
xf86LogFileFrom = X_CMDLINE;
|
||||||
}
|
return 2;
|
||||||
}
|
}
|
||||||
if (!strcmp(argv[i], "-config") || !strcmp(argv[i], "-xf86config")) {
|
if (!strcmp(argv[i], "-config") || !strcmp(argv[i], "-xf86config")) {
|
||||||
CHECK_FOR_REQUIRED_ARGUMENT();
|
CHECK_FOR_REQUIRED_ARGUMENT();
|
||||||
|
|
Loading…
Reference in New Issue