Commit Graph

1756 Commits

Author SHA1 Message Date
Kaarle Ritvanen
982e7b6ea4 lxc-alpine: option for specifying the release to be installed
Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-06-27 08:47:39 -05:00
Kaarle Ritvanen
85b41c7d7f lxc-alpine: automatic repository selection
pick random server from mirror list
use the latest stable release

Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-06-27 08:47:38 -05:00
Andrew Gilbert
37cb98a2b7 Add -n differentiation to lxc-netstat
lxc-netstat now only processes an -n argument if it has not previously
received a value for $name from --name or -n. If it _has_ received such
a value, it stops processing arguments and leaves the -n for netstat.
This does not apply to the use of --name after a name has been provided
by --name or -n; the current behaviour continues. The new behaviour
makes
	netstat -n <container> -n -a
behave like
	netstat -n <container> -a -n
which already will act as though there is '--' between '<container>' and
'-a' (see line 91 of lxc-netstat.in).

Signed-off-by: Andrew Gilbert <andrewg800@gmail.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-06-27 08:10:53 -05:00
Andrew Gilbert
1a7cb08504 Add double-dash to lxc-netstat re-call arguments
When lxc-netstat was called by lxc-unshare, it would be given the
arguments intended for netstat from the first invocation, but without
anything to separate them from the arguments intended for lxc-netstat.
This meant that netstat arguments like -n would result in lxc-netstat
trying to process them.

Signed-off-by: Andrew Gilbert <andrewg800@gmail.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-06-27 08:10:44 -05:00
Serge Hallyn
176d9acb2e api_clone: don't remove storage if we haven't created it
In the best case we'll get errors about failing to remove it.  In the
worst case we'll be trying to delete the original container's rootfs.

Reported-by: zoolook <nbensa+lxcusers@gmail.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-06-24 13:56:05 -05:00
Serge Hallyn
ae3f8cf9a4 Accept more word delimiters when updating hooks
When updating container names in hook files during a container clone,
we substitute the new container name for the old any time the old name
shows up as a separate word.  This patch adds the four characters
'.,_-' as additional delimiters.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-06-24 13:56:03 -05:00
Stéphane Graber
618fa49ddd
lxc-start-ephemeral: Fix get_ips call
The timeout option in get_ips has been deprecated, so work around it.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2013-06-19 14:12:37 -04:00
Serge Hallyn
54c30e2908 conf.c: always strdup rootfs.mount
The reason is that the generic code which handles reading
lxc.rootfs.mount always frees the old value if not NULL.
So without this setting lxc.rootfs.mount = /mnt causes
segfault.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-06-18 14:52:24 -05:00
Serge Hallyn
37903589a2 don't set up console for lxc-execute
Currently due to some safety checks for !rootfs.path, lxc-execute works
ok if you do not set lxc.rootfs at all in your lxc.conf. But if you
set lxc.rootfs = '/', then it sets up console, and when you do an
lxc-execute, the console appears hung.

However the lxc.rootfs NULL check was just incidental to not dereference
a NULL pointer.  In fact we should not be setting up a console if the
container isn't running a full-fledged distro with a getty/login
running on the container's /dev/console.

Have lxc_execute() mark in lxc_conf that this is a lxc-execute and not
an lxc-start, and don't set up the console.

The issue is documented at https://sourceforge.net/p/lxc/bugs/67/ .

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Dwight Engen <dwight.engen@oracle.com>
2013-06-13 12:03:36 -05:00
Dwight Engen
b515981702 console API improvements
Add a higher level console API that opens a tty/console and runs the
mainloop as well. Rename existing API to console_getfd(). Use these in
the python binding.

Allow attaching a console peer after container bootup, including if the
container was launched with -d. This is made possible by allocation of a
"proxy" pty as the peer when the console is attached to.

Improve handling of SIGWINCH, the pty size will be correctly set at the
beginning of a session and future changes when using the lxc_console() API
will be propagated to it as well.

Refactor some common code between lxc_console.c and console.c. The variable
wait4q (renamed to saw_escape) was static, making the mainloop callback not
safe across threads. This wasn't a problem when the callback was in the
non-threaded lxc-console, but now that it is internal to console.c, we have
to take care of it. This is now contained in a per-tty state structure.

Don't attempt to open /dev/null as the console peer since /dev/null cannot
be added to the mainloop (epoll_ctl() fails with EPERM). This isn't needed
to get the console setup (and the log to work) since the case of not having
a peer at console init time has to be handled to allow for attaching to it
later.

Move signalfd libc wrapper/replacement to utils.h.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-06-12 15:53:08 -05:00
Natanael Copa
5d4d3ebb13 lxc-init: continue even if we fail to mount /dev/mqueue
The 'lxc-init' (a lightweight init process used by lxc-execute in place
of upstart etc) tries to mount /dev/mqueue during startup. If that fails
(for instance due to missing support for mqueue in kernel) then it
aborts execution and returns -1. This is unreasonable as very few
applications actually need /dev/mqueue.

This similar to what we do with /dev/shm.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-06-12 08:06:28 -05:00
Serge Hallyn
71b0fed669 lxclock: move container locks into /run/lock
Currently the lxc API mutexes configuration file read/writes with a
lock called $lxcpath/locks/$lxcname.  This fails if the container
is on a rofs.

This patch moves those locks under /run/lock/lxc.

The $lxcpath/$lxcname/partial file is not moved - if you can't
create it, you probably can't create the container either.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-06-11 12:43:25 -05:00
Serge Hallyn
54b79829e2 lxc_stop: return success if api_shutdown succeeded
I originally forgot to set ret = 0 if it succeeded, meaning that a
simple 'lxc-stop -n container1' returns failure even though the
stop succeeded.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-06-10 14:35:03 -05:00
Serge Hallyn
6e46cfcb0e conf.c: if we don't specify a rootfs, we still need proc mounted
otherwise we won't be allowed to set an apparmor context (on pid 1)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-06-10 10:57:23 -05:00
Qiang Huang
fabf7361da lxc-execute: allow lxc-init to log only when we have a valid log level
Right now if we use lxc-execute without log level set, we get error:
lxc: invalid log priority NOTSET.
Because we set log level manually in execute_start(), but didn't
check if we have a valid log level or not, so fix it.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-06-10 07:20:38 -05:00
Weng Meiling
38973621a4 lxc-ps: display process when container is frozen
When we use lxc-ps to show the process, it's  more appropriate to
show process when container is frozen.

Signed-off-by: Weng Meiling <wengmeiling.weng@huawei.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-06-10 07:11:54 -05:00
Rui Xiang
31f58b3fce lxc-monitord: remove hard code execvp path of lxc-monitord
Sometimes, the path of lxc tools is not '/usr/bin', but
'/usr/local/bin' or other. Then execvp lxc-monitord will fail
in lxc_monitord_spawn.

Signed-off-by: Rui Xiang <rui.xiang@huawei.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-06-10 07:07:29 -05:00
Dwight Engen
f02abefef9 fix check for lock acquired
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-06-10 06:47:30 -05:00
Serge Hallyn
93dc5327aa lxclock and lxccontainer: switch from flock to fcntl
flock is not supported on nfs.  fcntl is at least supported on newer
(v3 and above) nfs.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Tested-by: zoolook <nbensa+lxcusers@gmail.com>
2013-06-05 16:41:55 -05:00
Weng Meiling
1af60b514f lxc-ps: fix the display problem with arg --lxc
When we use arg --lxc to show processes in all containers, no
process displays, so fix it.

(Changelog: Serge: in-line fix of s/;;/;/ at line 69)

Signed-off-by: Weng Meiling <wengmeiling.weng@huawei.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-06-04 23:05:39 -05:00
Serge Hallyn
eddaaafd1a implement loopback backing store
Create a loopfile backed container by doing:

	lxc-create -B loop -t template -n name

or

	lxc-clone -B loop -o dir1 -n loop1

The rootfs in the configuration file will be

	loop:/var/lib/lxc/loop1/rootdev

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-06-03 16:38:13 -05:00
Serge Hallyn
f002c8a765 lxc_create: support 'lxc-create -t <template> -h'
With the lxc-create script, 'lxc-create -t template -h' used to call
'template -h' to get template-specific help.  The api based lxc-create
did not yet support that.

Add a 'helpfn' method to the lxc_arguments, which is called at the end
of printhelp, and passed the lxc_arguments.  Use that in lxc_create to
reintroduce the desired behavior.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-06-03 11:22:42 -05:00
Qiang Huang
4c1f6b67d9 lxc-destroy: fix the wrong help info of lxc-destroy
Changelog: jun 3: (Serge) trivial typo fix inline.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-06-03 10:54:06 -05:00
Qiang Huang
3155e7f954 lxc-create: fix the typo in help info
Fix typo in help info of lxc-create, and get rid of duplicate
comments in bdev.h

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-06-03 10:53:41 -05:00
Qiang Huang
63c3090c91 arguments: should return negative number when error happens
We should return -ENOMEM instead of ENOMEM when realloc fails.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-06-03 10:52:39 -05:00
Serge Hallyn
44ef0c0c72 lxcapi_create: don't close stdin/out/err
Otherwise we can't see template progress.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-06-03 10:52:13 -05:00
Natanael Copa
569bee5cc3 lxc-alpine: download a static package manager if its missing
If the package manager, apk-tools is missing, then:
 - download a static binary and public keys
 - verify the keys against embedded checksum
 - verify the signature of the static binary against the downloaded keys
 - use the verified static binary

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-06-03 10:51:59 -05:00
Serge Hallyn
0a18b5458b Define LXC_DEFAULT_CONFIG
And use it in place of the various ways we were deducing /etc/lxc/default.conf.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-05-31 11:14:33 -05:00
Serge Hallyn
3a647d582d configure/makefile: rename default_conf to distro_conf
configure/makefile: rename default_conf to distro_conf, since it is a per-distro
default.  Then we'll be able to use the symbol LXC_DEFAULT_CONF in the code to
refer to the installed file.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-05-31 11:14:26 -05:00
Serge Hallyn
3bc449ed24 lxccontainer: update locking comment
Update the LOCKING comment.

Take mem_lock in want_daemonize.

convert lxcapi_destroy to not use privlock/slock by hand.

Fix a coverity-found potential dereference of NULL c->lxc_conf.

api_cgroup_get_item() and api_cgroup_set_item(): use disklock,
not memlock, since the values are set through the cgroup fs on
the running container.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-05-31 11:14:14 -05:00
Serge Hallyn
73e608b21f waitpid at abort to make sure we can rmdir cgroups
If we abort the container start, and don't wait for the init task to be
reaped after we kill it, then we can't remove the container cgroup
because it is not empty.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-05-31 07:45:23 -05:00
Serge Hallyn
39dc698cb4 lxccontainer: don't lock around getstate and freeze/unfreeze (v2)
Those go through commands.c and are already mutex'ed that way.

Also remove a unmatched container_disk_unlock in lxcapi_create.

Since is_stopped uses getstate which is no longer locked, rename
it to drop the _locked suffix.

And convert save_config to taking the disk lock.  This way the
save_ and load_config are mutexing each other, as they should.

Changelog: May 29:
   Per Dwight's comment, take the lock before opening the config
      FILE *.
   Only take disklock at load and save_config when we're using the
   container's config file, not when read/writing from/to another
   file.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Dwight Engen <dwight.engen@oracle.com>
2013-05-29 13:54:11 -05:00
Dwight Engen
0115f8fd27 add console to lxc api
Make lxc_cmd_console() return the fd from the socket connection to the
caller. This fd keeps the tty slot allocated until the caller closes
it. Returning the fd allows for a long lived process to close the fd
and reuse consoles.

Add API function for console allocation.

Create test program for console API.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-05-29 12:34:46 -05:00
Qiang Huang
3db989bad5 lxc-console: use fd instead of 0 in setup_tios
We should use the fd specified by caller.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-05-29 09:03:51 -05:00
Dwight Engen
dc5e436e70 lxc.spec.in: remove lxc-shutdown (for commit 3e625e2d)
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-05-29 09:03:49 -05:00
Serge Hallyn
5790f7b7a7 api_clone: call is_stopped_locked() to avoid deadlock.
Technically as Dwight has mentioned we should probably drop the locking
from api_state() altogether, since those are protected through the
lxc command system.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-05-28 15:27:42 -05:00
Serge Hallyn
64f782ca69 lxc.conf.sgml.in: fill in missing configuration file statements
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-05-28 14:07:43 -05:00
Serge Hallyn
1897e3bcd3 Move container creation fully into the api
1. implement bdev->create:

python and lua: send NULL for bdevtype and bdevspecs.
They'll want to be updated to pass those in in a way that makes
sense, but I can't think about that right now.

2. templates: pass --rootfs

If the container is backed by a device which must be mounted (i.e.
lvm) then pass the actual rootfs mount destination to the
templates.

Note that the lxc.rootfs can be a mounted block device.  The template
should actually be installing the rootfs under the path where the
lxc.rootfs is *mounted*.

Still, some people like to run templates by hand and assume purely
directory backed containers, so continue to support that use case
(i.e. if no --rootfs is listed).

Make sure the templates don't re-write lxc.rootfs if it is
already in the config.  (Most were already checking for that)

3. Replace lxc-create script with lxc_create.c program.

Changelog:
May 24: when creating a container, create $lxcpath/$name/partial,
and flock it.  When done, close that file and unlink it.  In
lxc_container_new() and lxcapi_start(), check for this file.  If
it is locked, create is ongoing.  If it exists but is not locked,
create() was killed - remove the container.

May 24: dont disk-lock during lxcapi_create.  The partial lock
is sufficient.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-05-25 19:27:07 -05:00
Serge Hallyn
60bf62d4ae destroy: implement in the api
This requires implementing bdev->ops->destroy() for each of the backing
store types.  Then implementing lxcapi_clone(), writing lxc_destroy.c
using the api, and removing the lxc-destroy.in script.

(this also has a few other cleanups, like marking some functions
static)

Changelog:
	fold into destroy: fix zfs destroy
	destroy: use correct program name in help

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-05-24 23:37:04 -05:00
Serge Hallyn
3e625e2d2e lxc-stop: use api, remove lxc_shutdown, extend lxc-stop functionality
implement c->reboot(c) in the api.

Also if the container is not running, return -2.  Currently
lxc-stop will return 0, so you cannot tell the difference
between successfull stopping and noop.

Per stgraber's email:

 - Remove lxc-shutdown
 - Change lxc-stop so that:
   * Default behaviour is to call shutdown(), wait 15s for STOPPED, if
not STOPPED, print a message to the user and call stop() [ NOTE:
actually 60 seconds per followup thread]
   * We have a -r option to reboot the container (with proper check that
the container indeed rebooted within the next 15s)
   * We have a -s option to shutdown the container without the automatic
fallback to stop()
   * Add a -k option allowing a user to just kill a container
(equivalent to old lxc-stop, no shutdown() call and no delay).

and update manpages.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-05-24 23:31:28 -05:00
Serge Hallyn
5cee8c5040 locking: update per Dwight's comment
Create three pairs of functions:
	int process_lock(void);
	void process_unlock(void);
	int container_mem_lock(struct lxc_container *c)
	void container_mem_unlock(struct lxc_container *c)
	int container_disk_lock(struct lxc_container *c);
	void container_disk_unlock(struct lxc_container *c);

and use those in lxccontainer.c

process_lock() is to protect the process state among multiple threads.
container_mem_lock() is to protect a struct container among multiple
threads.  container_disk_lock is to protect a container on disk.

Also remove the lock in lxcapi_init_pid() as Dwight suggested.

Fix a typo (s/container/contain) spotted by Dwight.

More locking fixes are needed, but let's first the the fundamentals
right.  How close does this get us?

Changelog: v2:
	fix lxclock compile

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Dwight Engen <dwight.engen@oracle.com>
2013-05-24 23:27:21 -05:00
Serge Hallyn
df271a59cb lxclock: Replace named sempahore with flock
The problem: if a task is killed while holding a posix semaphore,
there appears to be no way to have the semaphore be reliably
autmoatically released.  The only trick which seemed promising
is to store the pid of the lock holder in some file and have
later lock seekers check whether that task has died.

Instead of going down that route, this patch switches from a
named posix semaphore to flock.  The advantage is that when
the task is killed, its fds are closed and locks are automatically
released.

The disadvantage of flock is that we can't rely on it to exclude
threads.  Therefore c->slock must now always be wrapped inside
c->privlock.

This patch survived basic testing with the lxcapi_create patchset,
where now killing lxc-create while it was holding the lock did
not lock up future api commands.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-05-24 23:21:18 -05:00
Dwight Engen
2acf779552 fix memory leaks in cgroup functions
There were several memory leaks in the cgroup functions, notably in the
success cases.

The cgpath test program was refactored and additional tests added to it.
It was used in various modes under valgrind to test that the leaks were
fixed.

Simplify lxc_cgroup_path_get() and cgroup_path_get by having them return a
char * instead of an int and an output char * argument. The only return
values ever used were -1 and 0, which are now handled with NULL and non-NULL
returns respectively.

Use consistent variable names of cgabspath when refering to an absolute path
to a cgroup subsystem or file, and cgrelpath when refering to a container
"group/name" within the cgroup heirarchy.

Remove unused subsystem argument to lxc_cmd_get_cgroup_path().

Remove unused #define MAXPRIOLEN

Make template arg to lxcapi_create() const

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-05-24 19:16:22 -05:00
Dwight Engen
6a44839f59 consolidate missing C library functions into utils.h
This fixes the build of lxccontainer.c on systems that have __NR_setns
but not HAVE_SETNS.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-05-24 19:16:20 -05:00
Stéphane Graber
ad5f151515
python: Fix lxc-ls's usage of get_ips()
The recent port of get_ips() from pure python to the C API came with
a couple of API changes for that function call (as were highlighted in
the commit message).

I somehow didn't notice that lxc-ls was still calling with the old API
and so was crashing whenever it was asked to show the ipv4 or ipv6 address.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2013-05-22 22:28:43 -04:00
Michael H. Warfield
5bb4a226eb lxc-fedora template. Cleanup for rootfs.
This is just some minor changes in the way the Fedora template is
synthesizing the target rootfs_path.  Currently, the template uses a
path with the container in it twice like this:

/var/lib/lxc/rasputin/rasputin/rootfs

This happens because the container name is already contained in the
"path" and the template appends it a second time.  This changes the
logic to be congruent with other templates such as lxc-arch.  The new
behavior will be to create the rootfs like this:

/var/lib/lxc/rasputin/rootfs

Attached below the jump.

Regards,
Mike
--
Michael H. Warfield (AI4NB) | (770) 985-6132 |  mhw@WittsEnd.com
   /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
   NIC whois: MHW9          | An optimist believes we live in the best of all
 PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!
--

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-05-21 20:32:24 -05:00
Dwight Engen
65be441e08 oracle template: mount /dev/shm as tmpfs
sem_open(3) checks that /dev/shm is SHMFS_SUPER_MAGIC. Normally /dev/shm
is mounted in the initramfs created by dracut, but that won't be run for
a container so make sure that rc.sysinit mounts /dev/shm.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-05-21 20:32:22 -05:00
Dwight Engen
481624b37b fix build with --enable-tests
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-05-21 20:32:20 -05:00
Serge Hallyn
fa9ac567a7 attach: and cgroup.c: be overly cautious
Realistically (as Dwight points out) it doesn't seem possible that
getline won't return at least one line in this functions, however
just to make absolutely sure we don't get a segv on free(NULL),
check line != NULL before freeing it on exit.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-05-21 20:31:04 -05:00
Dwight Engen
20fe4e8feb fix getline(3) memory leaks
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-05-21 20:30:19 -05:00