diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2016-11-06 12:56:31 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@herrb.eu> | 2020-07-14 15:52:35 +0200 |
commit | 42dddd311ab0b366b9a3d115debe06e1cdf9f8c3 (patch) | |
tree | 5ddda842157937358e2bb70791ba930c28251f6d | |
parent | 17846f03629d7e2be9319a6126564c026df5167d (diff) |
Rework the Xservers parsing code to correctly reject non local display types.
-rw-r--r-- | xenodm/file.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/xenodm/file.c b/xenodm/file.c index 732bc2f..d171048 100644 --- a/xenodm/file.c +++ b/xenodm/file.c @@ -130,12 +130,9 @@ freeSomeArgs (char **args, int n) static int -parseDisplayType (char *string) +isLocal (char *string) { - if (strcmp(string, "local") == 0) - return 0; - else - return 1; + return (strcmp(string, "local") == 0); } void @@ -144,7 +141,6 @@ ParseDisplay (char *source) char **args, **argv, **a; char *name, *class, *type; struct display *d; - int usedDefault; Boolean local; args = splitIntoWords (source); @@ -163,7 +159,7 @@ ParseDisplay (char *source) freeFileArgs (args); return; } - usedDefault = parseDisplayType(args[1]); + local = isLocal (args[1]); class = NULL; type = args[1]; argv = args + 2; @@ -173,17 +169,14 @@ ParseDisplay (char *source) * argument does, use the second argument as the * display class string */ - if (usedDefault && args[2]) + if (!local && args[2]) { - usedDefault = parseDisplayType (args[2]); - if (!usedDefault) - { - class = args[1]; - type = args[2]; - argv = args + 3; - } + local = isLocal (args[2]); + class = args[1]; + type = args[2]; + argv = args + 3; } - if (!local) + if (!local) { LogError ("Unacceptable display type %s for display %s\n", type, name); |