diff options
author | David Herrmann <dh.herrmann@googlemail.com> | 2012-12-06 14:03:54 +0100 |
---|---|---|
committer | David Herrmann <dh.herrmann@googlemail.com> | 2012-12-06 14:03:54 +0100 |
commit | 3cebf533fc9f65bcacbd527698223cf3f2b8f0f5 (patch) | |
tree | 6e38de3c3a04491598051eaf634369aa03461fe7 /src/kmscon_conf.c | |
parent | 2ac94213771155431a73cbbafc570b213efaf414 (diff) |
kmscon: prevent --no-listen in combination with --cdev-session
cdev sessions should only be used in listen-mode to avoid stacking cdev
sessions.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Diffstat (limited to 'src/kmscon_conf.c')
-rw-r--r-- | src/kmscon_conf.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/kmscon_conf.c b/src/kmscon_conf.c index b23376e..95158c8 100644 --- a/src/kmscon_conf.c +++ b/src/kmscon_conf.c @@ -471,6 +471,23 @@ static int aftercheck_vt(struct conf_option *opt, int argc, char **argv, return 0; } +static int aftercheck_listen(struct conf_option *opt, int argc, char **argv, + int idx) +{ + struct kmscon_conf_t *conf = KMSCON_CONF_FROM_FIELD(opt->mem, listen); + int ret = -EFAULT; + + if (conf->listen) + return 0; + + if (conf->cdev_session) + log_error("you can use --cdev-session only in combination with --listen"); + else + ret = 0; + + return ret; +} + /* * Default Values * We use static default values to avoid allocating memory for these. This @@ -527,7 +544,7 @@ int kmscon_conf_new(struct conf_ctx **out) CONF_OPTION_BOOL_FULL(0, "debug", aftercheck_debug, NULL, NULL, &conf->debug, false), CONF_OPTION_BOOL(0, "silent", &conf->silent, false), CONF_OPTION_STRING('c', "configdir", &conf->configdir, "/etc/kmscon"), - CONF_OPTION_BOOL(0, "listen", &conf->listen, false), + CONF_OPTION_BOOL_FULL(0, "listen", aftercheck_listen, NULL, NULL, &conf->listen, false), /* Seat Options */ CONF_OPTION(0, 0, "vt", &conf_vt, aftercheck_vt, NULL, NULL, &conf->vt, NULL), |