Index: src/lxc_driver.c =================================================================== RCS file: /data/cvs/libxen/src/lxc_driver.c,v retrieving revision 1.2 diff -p -r1.2 lxc_driver.c *** src/lxc_driver.c 27 Mar 2008 09:34:06 -0000 1.2 --- src/lxc_driver.c 28 Mar 2008 12:53:14 -0000 *************** *** 61,67 **** static int lxcStartup(void); static int lxcShutdown(void); ! static lxc_driver_t *lxc_driver; /* Functions */ static int lxcDummyChild( void *argv ATTRIBUTE_UNUSED ) --- 61,67 ---- static int lxcStartup(void); static int lxcShutdown(void); ! static lxc_driver_t *lxc_driver = NULL; /* Functions */ static int lxcDummyChild( void *argv ATTRIBUTE_UNUSED ) *************** static char *lxcDomainDumpXML(virDomainP *** 378,383 **** --- 378,390 ---- static int lxcStartup(void) { + uid_t uid = getuid(); + + /* Check that the user is root */ + if (0 != uid) { + return -1; + } + lxc_driver = calloc(1, sizeof(lxc_driver_t)); if (NULL == lxc_driver) { return -1; *************** static void lxcFreeDriver(lxc_driver_t * *** 412,422 **** static int lxcShutdown(void) { ! lxc_vm_t *vms = lxc_driver->vms; ! ! lxcFreeVMs(vms); lxc_driver->vms = NULL; lxcFreeDriver(lxc_driver); return 0; } --- 419,430 ---- static int lxcShutdown(void) { ! if (lxc_driver == NULL) ! return(NULL); ! lxcFreeVMs(lxc_driver->vms); lxc_driver->vms = NULL; lxcFreeDriver(lxc_driver); + lxc_driver = NULL; return 0; } *************** static int lxcShutdown(void) *** 430,435 **** --- 438,445 ---- */ static int lxcActive(void) { + if (lxc_driver == NULL) + return(0); /* If we've any active networks or guests, then we * mark this driver as active */