Commit 032b1d79 authored by Emil Velikov's avatar Emil Velikov Committed by Adam Jackson

xfree86: use the xf86CheckPrivs() helper for modulepath/logfile

v2: Rebase against updated xf86CheckPrivs() helper.
Reviewed-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
Signed-off-by: Emil Velikov's avatarEmil Velikov <emil.l.velikov@gmail.com>
parent 0fdd4756
...@@ -1120,33 +1120,29 @@ ddxProcessArgument(int argc, char **argv, int i) ...@@ -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]); CHECK_FOR_REQUIRED_ARGUMENT();
} xf86CheckPrivs(argv[i], argv[i + 1]);
else if (!strcmp(argv[i], "-modulepath")) { mp = strdup(argv[i + 1]);
char *mp; if (!mp)
FatalError("Can't allocate memory for ModulePath\n");
CHECK_FOR_REQUIRED_ARGUMENT(); xf86ModulePath = mp;
mp = strdup(argv[i + 1]); xf86ModPathFrom = X_CMDLINE;
if (!mp) return 2;
FatalError("Can't allocate memory for ModulePath\n"); }
xf86ModulePath = mp; if (!strcmp(argv[i], "-logfile")) {
xf86ModPathFrom = X_CMDLINE; char *lf;
return 2;
} CHECK_FOR_REQUIRED_ARGUMENT();
else if (!strcmp(argv[i], "-logfile")) { xf86CheckPrivs(argv[i], argv[i + 1]);
char *lf; lf = strdup(argv[i + 1]);
if (!lf)
CHECK_FOR_REQUIRED_ARGUMENT(); FatalError("Can't allocate memory for LogFile\n");
lf = strdup(argv[i + 1]); xf86LogFile = lf;
if (!lf) xf86LogFileFrom = X_CMDLINE;
FatalError("Can't allocate memory for LogFile\n"); return 2;
xf86LogFile = lf;
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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment