[lxc-devel] [lxc/lxc] e2426f: fix lxc-info printing duplicate lines

GitHub noreply at github.com
Thu Apr 3 23:37:27 UTC 2014


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: e2426f0bb0a2e94593134fdec0aca95fee53eef0
      https://github.com/lxc/lxc/commit/e2426f0bb0a2e94593134fdec0aca95fee53eef0
  Author: Dwight Engen <dwight.engen at oracle.com>
  Date:   2014-04-03 (Thu, 03 Apr 2014)

  Changed paths:
    M src/lxc/lxc_info.c

  Log Message:
  -----------
  fix lxc-info printing duplicate lines

When lxc-info's stdout is not line buffered (ie. "lxc-info -n foo |more")
the first three lines will be duplicated. This is because c->get_ips()
comes next and it forks and the child will exit() causing its fds to be
closed which flushes out its (fork duplicated) stdio buffers. The lines are
then duplicated when the parent actually gets around to flushing out its
stdio. This causes problems for programs (such as the lxc-webpanel) which
are popen()ing lxc-info.

The fix here isn't necessarily the right one, but does show what the
problem is. Seems like maybe we should fix this inside of get_ips(), for
other API callers as well.

Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>




More information about the lxc-devel mailing list