[libvirt] [PATCH] Set the 'container_ttys' env variable for LXC consoles
Eric Blake
eblake at redhat.com
Fri Dec 13 17:00:29 UTC 2013
On 12/13/2013 09:52 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at 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=1d97ff7dd71902a5604c2fed8964925d54e09de9
>
> Signed-off-by: Daniel P. Berrange <berrange at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20131213/076944fd/attachment-0001.sig>
More information about the libvir-list
mailing list