From mboxrd@z Thu Jan 1 00:00:00 1970 From: Li Zefan Subject: Re: [PATCH 2/2] cgroups: fix cgroup_event_listener error handling Date: Tue, 8 Jan 2013 14:28:44 +0800 Message-ID: <50EBBC9C.7060909@huawei.com> References: <1357333518-28899-1-git-send-email-gthelen@google.com> <1357333518-28899-2-git-send-email-gthelen@google.com> <20130107174427.GM3926@htj.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Greg Thelen Cc: Tejun Heo , cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > 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 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 Acked-by: Li Zefan > --- > tools/cgroup/cgroup_event_listener.c | 72 ++++++++++----------------------- > 1 files changed, 22 insertions(+), 50 deletions(-)