]> git.baikalelectronics.ru Git - kernel.git/commit
cgroups: fix cgroup_event_listener error handling
authorGreg Thelen <gthelen@google.com>
Mon, 7 Jan 2013 19:50:17 +0000 (11:50 -0800)
committerTejun Heo <tj@kernel.org>
Tue, 8 Jan 2013 18:00:44 +0000 (10:00 -0800)
commitbd2456666690737fa8bdc0af7680ac4deb81902f
treea268f0a96609fb09408fb77fd5474489cbb63c76
parent6358b4782f8ab5c2ed510dce5cb64c9f03b32b6b
cgroups: fix cgroup_event_listener error handling

The error handling in cgroup_event_listener.c did not correctly deal
with either an error opening either <control_file> or
cgroup.event_control.  Due to an uninitialized variable the program
exit code was undefined if either of these opens failed.

This patch simplifies and corrects cgroup_event_listener.c error
handling by:
1. using err*() rather than printf(),exit()
2. depending on process exit to close open files

With this patch failures always return non-zero error.

Signed-off-by: Greg Thelen <gthelen@google.com>
Acked-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
tools/cgroup/cgroup_event_listener.c