On 12/13/2013 09:52 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Systemd specified that any /dev/pts/NNN device on which it
is expected to spawn a agetty login, should be listed in
s/ a / an /
the 'container_ttys' env variable. It should just contain
the relative paths, eg 'pts/0' not '/dev/pts/0' and should
be space separated.
http://cgit.freedesktop.org/systemd/systemd/commit/?id=1d97ff7dd71902a560...
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/lxc/lxc_container.c | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
ACK with nits:
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
+ size_t i;
+
+ for (i = 0 ; i < nttyPaths ; i++) {
Doesn't this violate 'make syntax-check' for space before ';'?
+ if (!STRPREFIX(ttyPaths[0], "/dev/")) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expected a /dev path for '%s'"),
+ ttyPaths[0]);
+ virBufferFreeAndReset(&buf);
+ return NULL;
+ }
+ if (i)
+ virBufferAddLit(&buf, " ");
virBufferAddChar is more efficient.
+ virBufferAdd(&buf, ttyPaths[i] + 5, -1);
+ }
I kind of like the style of:
for (...) {
add element and separator
}
use virBufferTrim() to undo the final separator
as slightly shorter than:
for (...) {
add element
if (not last)
add separator
}
or:
for (...) {
if (not first)
add separator
add element
}
but it's not necessary to change that.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org