]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Prevent streams from becoming libvirtd controlling TTY
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 13 Mar 2013 17:22:28 +0000 (17:22 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Thu, 14 Mar 2013 12:42:21 +0000 (12:42 +0000)
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 <berrange@redhat.com>
src/fdstream.c

index cc2dfe9fac57eefe58f9889b6340cbc0f0b9fd31..9a6f042f069636af14848587c3e29a992faa7660 100644 (file)
@@ -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