[lxc-devel] [lxc/lxc] d96556: lxc-attach: fix redirection - stderr

GitHub noreply at github.com
Sat Mar 5 04:19:46 UTC 2016


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: d96556572ce4e64837c03eec1f64121a2bc8a3f8
      https://github.com/lxc/lxc/commit/d96556572ce4e64837c03eec1f64121a2bc8a3f8
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-03-05 (Sat, 05 Mar 2016)

  Changed paths:
    M src/lxc/lxc_attach.c

  Log Message:
  -----------
  lxc-attach: fix redirection - stderr

So that we can do things like:

	lxc-attach -n a -- sh -c 'echo ERR >&2' > /dev/null

There seems to be no easy way to discern when we need to write to stderr
instead of stdout when we receive an event on the master fd of an allocated
pty. So we're using a "trick"/"hack". We write to STDOUT_FILENO if it refers to
a pty. If STDOUT_FILENO does not refer to a pty we check whether STDERR_FILENO
refers to a pty and if so write to it.

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


  Commit: 8d1ea537851718553358a4a9767274f893b40420
      https://github.com/lxc/lxc/commit/8d1ea537851718553358a4a9767274f893b40420
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-03-05 (Sat, 05 Mar 2016)

  Changed paths:
    M src/tests/Makefile.am
    A src/tests/lxc-test-lxc-attach

  Log Message:
  -----------
  tests: add lxc-test-attach-test

Test if the various types of I/O redirection work with lxc-attach.

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


  Commit: a8a0f65d24dce4e2e2e1acb39b8e366be2c8e310
      https://github.com/lxc/lxc/commit/a8a0f65d24dce4e2e2e1acb39b8e366be2c8e310
  Author: Serge Hallyn <serge at hallyn.com>
  Date:   2016-03-04 (Fri, 04 Mar 2016)

  Changed paths:
    M src/lxc/lxc_attach.c
    M src/tests/Makefile.am
    A src/tests/lxc-test-lxc-attach

  Log Message:
  -----------
  Merge pull request #873 from brauner/bugfix_branch

lxc-attach: fix redirection - stderr


Compare: https://github.com/lxc/lxc/compare/6861fb2291e6...a8a0f65d24dc


More information about the lxc-devel mailing list