[PATCHv2 10/27] lxc: reject unknown flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* src/lxc/lxc_driver.c (lxcOpen, lxcDomainSetMemoryParameters)
(lxcDomainGetMemoryParameters): Reject unknown flags.
* src/lxc/lxc_container.c (lxcContainerStart): Use unsigned flags.
---
 src/lxc/lxc_container.c |    4 ++--
 src/lxc/lxc_driver.c    |   12 +++++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index ef8469c..ffa2f34 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2010 Red Hat, Inc.
+ * Copyright (C) 2008-2011 Red Hat, Inc.
  * Copyright (C) 2008 IBM Corp.
  *
  * lxc_container.c: file description
@@ -889,7 +889,7 @@ int lxcContainerStart(virDomainDefPtr def,
                       char *ttyPath)
 {
     pid_t pid;
-    int flags;
+    unsigned int flags;
     int stacksize = getpagesize() * 4;
     char *stack, *stacktop;
     lxc_child_argv_t args = { def, nveths, veths, control, ttyPath,
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 799a5e7..4624e21 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -110,8 +110,10 @@ static void lxcDomainEventQueue(lxc_driver_t *driver,

 static virDrvOpenStatus lxcOpen(virConnectPtr conn,
                                 virConnectAuthPtr auth ATTRIBUTE_UNUSED,
-                                unsigned int flags ATTRIBUTE_UNUSED)
+                                unsigned int flags)
 {
+    virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
+
     /* Verify uri was specified */
     if (conn->uri == NULL) {
         if (lxc_driver == NULL)
@@ -746,7 +748,7 @@ cleanup:
 static int lxcDomainSetMemoryParameters(virDomainPtr dom,
                                         virTypedParameterPtr params,
                                         int nparams,
-                                        unsigned int flags ATTRIBUTE_UNUSED)
+                                        unsigned int flags)
 {
     lxc_driver_t *driver = dom->conn->privateData;
     int i;
@@ -754,6 +756,8 @@ static int lxcDomainSetMemoryParameters(virDomainPtr dom,
     virDomainObjPtr vm = NULL;
     int ret = -1;

+    virCheckFlags(0, -1);
+
     lxcDriverLock(driver);
     vm = virDomainFindByUUID(&driver->domains, dom->uuid);

@@ -843,7 +847,7 @@ cleanup:
 static int lxcDomainGetMemoryParameters(virDomainPtr dom,
                                         virTypedParameterPtr params,
                                         int *nparams,
-                                        unsigned int flags ATTRIBUTE_UNUSED)
+                                        unsigned int flags)
 {
     lxc_driver_t *driver = dom->conn->privateData;
     int i;
@@ -853,6 +857,8 @@ static int lxcDomainGetMemoryParameters(virDomainPtr dom,
     int ret = -1;
     int rc;

+    virCheckFlags(0, -1);
+
     lxcDriverLock(driver);
     vm = virDomainFindByUUID(&driver->domains, dom->uuid);

-- 
1.7.4.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]