[PATCH] [RDP compositor] don't crash when the key file doesn't exist

Derek Foreman derekf at osg.samsung.com
Wed Aug 5 11:10:46 PDT 2015


On 01/08/15 05:35 PM, David FORT wrote:
> This allows to close the remaining issue in
> https://bugs.freedesktop.org/show_bug.cgi?id=91390
> ---
>  src/compositor-rdp.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
> index 4ef0dd1..c76af61 100644
> --- a/src/compositor-rdp.c
> +++ b/src/compositor-rdp.c
> @@ -1102,7 +1102,10 @@ rdp_peer_init(freerdp_peer *client, struct rdp_backend *b)
>  	}
>  	settings->NlaSecurity = FALSE;
>  
> -	client->Initialize(client);
> +	if (!client->Initialize(client)) {
> +		weston_log("peer initialization failed\n");
> +		goto error_initialize;
> +	}

This fixes the missing key file crash (and missing a key file does
appear to be the only reason Initialize ever fails)

>  	settings->OsMajorType = OSMAJORTYPE_UNIX;
>  	settings->OsMinorType = OSMINORTYPE_PSEUDO_XSERVER;
> @@ -1113,7 +1116,6 @@ rdp_peer_init(freerdp_peer *client, struct rdp_backend *b)
>  	settings->FrameMarkerCommandEnabled = TRUE;
>  	settings->SurfaceFrameMarkerEnabled = TRUE;
>  
> -

Hmm, I guess there's no harm in this seemingly unrelated whitespace
change...

>  	client->Capabilities = xf_peer_capabilities;
>  	client->PostConnect = xf_peer_post_connect;
>  	client->Activate = xf_peer_activate;
> @@ -1129,7 +1131,7 @@ rdp_peer_init(freerdp_peer *client, struct rdp_backend *b)
>  
>  	if (!client->GetFileDescriptor(client, rfds, &rcount)) {
>  		weston_log("unable to retrieve client fds\n");
> -		return -1;
> +		goto error_initialize;

This doesn't actually have anything to do with missing key files...  But
it does properly close the client on failure?  Maybe this should be a
separate patch.

>  	}
>  
>  	loop = wl_display_get_event_loop(b->compositor->wl_display);
> @@ -1144,6 +1146,10 @@ rdp_peer_init(freerdp_peer *client, struct rdp_backend *b)
>  
>  	wl_list_insert(&b->output->peers, &peerCtx->item.link);
>  	return 0;
> +
> +error_initialize:

error_initialize is maybe a bit misleading when it gets a goto from
failed GetFileDescriptor too...

> +	client->Close(client);
> +	return -1;
>  }
>  
>  
> @@ -1152,7 +1158,7 @@ rdp_incoming_peer(freerdp_listener *instance, freerdp_peer *client)
>  {
>  	struct rdp_backend *b = (struct rdp_backend *)instance->param4;
>  	if (rdp_peer_init(client, b) < 0) {
> -		weston_log("error when treating incoming peer");
> +		weston_log("error when treating incoming peer\n");

This seems like it should go in different patch as well.

>  		FREERDP_CB_RETURN(FALSE);
>  	}




More information about the wayland-devel mailing list