cli: don't accidentaly set O_NDELAY on stderr
authorLennart Poettering <lennart@poettering.net>
Thu, 17 Sep 2009 01:51:35 +0000 (03:51 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 17 Sep 2009 01:59:25 +0000 (03:59 +0200)
commitb4d4f2b856cd0d5e24f777a088b9d4462567dac0
treeb142d2991633b76282bda396c8bd756ca1b224bc
parent94f28b9d4b7448c1e9bb6fb8a3b44f53988f6aa5
cli: don't accidentaly set O_NDELAY on stderr

Loading module-cli could have the effect of setting O_NDELAY on stderr,
because it was just a dup'ed fd of stdin which module-cli sets O_NDELAY
for and which flag is shared between all dupes.

Instead of using stdin/stdout directly we now open a new file descriptor
for the controlling terminal, which is equally useful as stdin/stdout
but gives a new file that does not share O_NDELAY with stdin/stdout.

This solves a problem where when running pulseaudio -C resulted in
log output being truncated since stdio does not really handle O_NDELAY
that well in on its fds.
src/modules/module-cli.c