From: Daniel P. Berrange Date: Wed, 13 Mar 2013 17:22:28 +0000 (+0000) Subject: Prevent streams from becoming libvirtd controlling TTY X-Git-Tag: v1.0.4-rc1~103 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2878ed860ceceec3cd6481424fed0b543b687cd;p=thirdparty%2Flibvirt.git Prevent streams from becoming libvirtd controlling TTY When opening a stream to a device which is a TTY, that device may become the controlling TTY of libvirtd, if libvirtd was daemonized. This in turn means when the other end of the stream closes, libvirtd gets SIGHUP, causing it to reload its config. Prevent this by forcing O_NOCTTY on all streams that are opened Signed-off-by: Daniel P. Berrange --- diff --git a/src/fdstream.c b/src/fdstream.c index cc2dfe9fac..9a6f042f06 100644 --- a/src/fdstream.c +++ b/src/fdstream.c @@ -582,6 +582,8 @@ virFDStreamOpenFileInternal(virStreamPtr st, VIR_DEBUG("st=%p path=%s oflags=%x offset=%llu length=%llu mode=%o", st, path, oflags, offset, length, mode); + oflags |= O_NOCTTY; + if (oflags & O_CREAT) fd = open(path, oflags, mode); else