[PATCH weston 1/2] weston-launch: move function calls out of assert()

Kristian Høgsberg hoegsberg at gmail.com
Tue Mar 19 11:31:02 PDT 2013


On Sat, Mar 09, 2013 at 07:38:56PM +0100, Philipp Brüschweiler wrote:
> ---
>  src/weston-launch.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)

Committed.  Whie the patch certainly improves the situation, maybe we
should just do actual error handling and exit with an error.  That
will also take care of the "assigned but not used" warning in the
NDEBUG case.

Kristian

> diff --git a/src/weston-launch.c b/src/weston-launch.c
> index bc7f8a2..98f0111 100644
> --- a/src/weston-launch.c
> +++ b/src/weston-launch.c
> @@ -209,6 +209,7 @@ setup_launcher_socket(struct weston_launch *wl)
>  static int
>  setup_signals(struct weston_launch *wl)
>  {
> +	int ret;
>  	sigset_t mask;
>  	struct sigaction sa;
>  	struct epoll_event ev;
> @@ -216,13 +217,16 @@ setup_signals(struct weston_launch *wl)
>  	memset(&sa, 0, sizeof sa);
>  	sa.sa_handler = SIG_DFL;
>  	sa.sa_flags = SA_NOCLDSTOP | SA_RESTART;
> -	assert(sigaction(SIGCHLD, &sa, NULL) == 0);
> +	ret = sigaction(SIGCHLD, &sa, NULL);
> +	assert(ret == 0);
>  
> -	assert(sigemptyset(&mask) == 0);
> +	ret = sigemptyset(&mask);
> +	assert(ret == 0);
>  	sigaddset(&mask, SIGCHLD);
>  	sigaddset(&mask, SIGINT);
>  	sigaddset(&mask, SIGTERM);
> -	assert(sigprocmask(SIG_BLOCK, &mask, NULL) == 0);
> +	ret = sigprocmask(SIG_BLOCK, &mask, NULL);
> +	assert(ret == 0);
>  
>  	wl->signalfd = signalfd(-1, &mask, SFD_NONBLOCK | SFD_CLOEXEC);
>  	if (wl->signalfd < 0)
> -- 
> 1.8.1.5
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list