[PATCH weston] weston-launch: Only pass non-NULL value into setenv()

Kristian Høgsberg hoegsberg at gmail.com
Mon Aug 12 22:24:58 PDT 2013


On Fri, Aug 09, 2013 at 11:30:38AM +0100, Rob Bradford wrote:
> From: Rob Bradford <rob at linux.intel.com>
> 
> getenv() can return NULL is the key is not set, passing NULL into
> setenv() is an error

Thanks, good catch.

Kristian

> ---
>  src/weston-launch.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/weston-launch.c b/src/weston-launch.c
> index 5b03094..7264f7e 100644
> --- a/src/weston-launch.c
> +++ b/src/weston-launch.c
> @@ -515,7 +515,8 @@ setup_session(struct weston_launch *wl)
>  
>  	term = getenv("TERM");
>  	clearenv();
> -	setenv("TERM", term, 1);
> +	if (term)
> +		setenv("TERM", term, 1);
>  	setenv("USER", wl->pw->pw_name, 1);
>  	setenv("LOGNAME", wl->pw->pw_name, 1);
>  	setenv("HOME", wl->pw->pw_dir, 1);
> -- 
> 1.8.3.1
> 
> _______________________________________________
> 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