return ret;
}
-static int config_console(const char *key, char *value, struct lxc_conf *lxc_conf)
+static int _config_console(const char *key, char *value, struct lxc_conf *lxc_conf)
{
int fd;
return 0;
}
+static int config_console(const char *key, char *value,
+ struct lxc_conf *lxc_conf)
+{
+ char *path;
+
+ path = strdup(value);
+ if (!path) {
+ SYSERROR("failed to strdup '%s': %m", value);
+ return -1;
+ }
+
+ lxc_conf->console.path = path;
+
+ return 0;
+}
+
static int config_rootfs(const char *key, char *value, struct lxc_conf *lxc_conf)
{
if (strlen(value) >= MAXPATHLEN) {
{
struct termios tios;
struct lxc_console *console = &conf->console;
+ int fd;
if (!conf->rootfs)
return 0;
goto err;
}
+ fd = open(console->path, O_CLOEXEC | O_RDWR | O_CREAT | O_APPEND, 0600);
+ if (fd < 0) {
+ SYSERROR("failed to open '%s'", console->path);
+ goto err;
+ }
+
+ console->peer = fd;
+
if (!isatty(console->peer))
return 0;