]> xenbits.xensource.com Git - libvirt.git/commitdiff
Mon Jun 9 15:42:34 PST 2008 David L. Leskovec <dlesko@linux.vnet.ibm.com>
authorDavid L. Leskovec <dlesko@linux.vnet.ibm.com>
Mon, 9 Jun 2008 22:51:32 +0000 (22:51 +0000)
committerDavid L. Leskovec <dlesko@linux.vnet.ibm.com>
Mon, 9 Jun 2008 22:51:32 +0000 (22:51 +0000)
* src/lxc_driver.c: Make console element is output only.  Always open new
PTY when starting a container.
Fix string overrun when storing console name in VM def struct

ChangeLog
src/lxc_driver.c

index 85d0fbe76fa84115211fab033c6d4cd8a603cf94..1aead245c6e66b2c356b811687b1b0d86f596ac0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Mon Jun  9 15:42:34 PST 2008 David L. Leskovec <dlesko@linux.vnet.ibm.com>
+
+       * src/lxc_driver.c: Console element is output only.  Always open new
+       PTY when starting a container.
+       Fix string overrun when storing console name in VM def struct
+
 Mon Jun  9 13:14:00 BST 2008 Richard W.M. Jones <rjones@redhat.com>
 
        Better error messages in xend driver.
@@ -56,7 +62,7 @@ Thu Jun  5 14:10:00 BST 2008 Richard W.M. Jones <rjones@redhat.com>
 
 Wed Jun  4 23:02:21 PST 2008 David L. Leskovec <dlesko@linux.vnet.ibm.com>
 
-       * src/lxc_driver.c: Add sanity of tty pid before kill()
+       * src/lxc_driver.c: Add sanity check of tty pid before kill()
        Ignore ECHILD errors during VM cleanup
        Call functions to store tty pid and cleanup tty pid file
        * src/lxc_conf.h: Add function to verify container process exists
index e765afa67990bb6acb4fdfb6824bbb164caf2505..33fa766bea0ec98fa35b2980c7568f7aad01eb72 100644 (file)
@@ -41,6 +41,7 @@
 #include "lxc_driver.h"
 #include "driver.h"
 #include "internal.h"
+#include "memory.h"
 #include "util.h"
 #include "memory.h"
 
@@ -484,7 +485,7 @@ static int lxcSetupTtyTunnel(virConnectPtr conn,
     char *ptsStr;
 
     if (0 < strlen(vmDef->tty)) {
-        *ttyDev = open(vmDef->tty, O_RDWR|O_NOCTTY|O_NONBLOCK);
+        *ttyDev = posix_openpt(O_RDWR|O_NOCTTY|O_NONBLOCK);
         if (*ttyDev < 0) {
             lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR,
                      "open() tty failed: %s", strerror(errno));
@@ -513,8 +514,11 @@ static int lxcSetupTtyTunnel(virConnectPtr conn,
             goto setup_complete;
         }
         /* This value needs to be stored in the container configuration file */
-        if (STRNEQ(ptsStr, vmDef->tty)) {
-            strcpy(vmDef->tty, ptsStr);
+        VIR_FREE(vmDef->tty);
+        if (!(vmDef->tty = strdup(ptsStr))) {
+            lxcError(conn, NULL, VIR_ERR_NO_MEMORY,
+                     _("unable to get storage for vm tty name"));
+            goto setup_complete;
         }
 
         /* Enter raw mode, so all characters are passed directly to child */