[Spice-devel] [vdagent-linux 2/3] Make creation of 'vdagent_file_xfers' optional
Marc-André Lureau
marcandre.lureau at gmail.com
Tue Apr 1 09:48:00 PDT 2014
ack
On Tue, Apr 1, 2014 at 4:24 PM, Christophe Fergeau <cfergeau at redhat.com>wrote:
> This commit only adds if (vdagent_file_xfers != NULL) {} checks before
> calling into the file transfer code. This allows to disable file transfer
> handling by setting this variable to NULL.
> ---
> src/vdagent.c | 30 ++++++++++++++++++++----------
> 1 file changed, 20 insertions(+), 10 deletions(-)
>
> diff --git a/src/vdagent.c b/src/vdagent.c
> index d7f7aba..3ab2352 100644
> --- a/src/vdagent.c
> +++ b/src/vdagent.c
> @@ -89,25 +89,33 @@ void daemon_read_complete(struct udscs_connection
> **connp,
> }
> break;
> case VDAGENTD_FILE_XFER_START:
> - vdagent_file_xfers_start(vdagent_file_xfers,
> - (VDAgentFileXferStartMessage *)data);
> + if (vdagent_file_xfers != NULL) {
> + vdagent_file_xfers_start(vdagent_file_xfers,
> + (VDAgentFileXferStartMessage *)data);
> + }
> free(data);
> break;
> case VDAGENTD_FILE_XFER_STATUS:
> - vdagent_file_xfers_status(vdagent_file_xfers,
> - (VDAgentFileXferStatusMessage *)data);
> + if (vdagent_file_xfers != NULL) {
> + vdagent_file_xfers_status(vdagent_file_xfers,
> + (VDAgentFileXferStatusMessage
> *)data);
> + }
> free(data);
> break;
> case VDAGENTD_FILE_XFER_DATA:
> - vdagent_file_xfers_data(vdagent_file_xfers,
> - (VDAgentFileXferDataMessage *)data);
> + if (vdagent_file_xfers != NULL) {
> + vdagent_file_xfers_data(vdagent_file_xfers,
> + (VDAgentFileXferDataMessage *)data);
> + }
> free(data);
> break;
> case VDAGENTD_CLIENT_DISCONNECTED:
> vdagent_x11_client_disconnected(x11);
> - vdagent_file_xfers_destroy(vdagent_file_xfers);
> - vdagent_file_xfers = vdagent_file_xfers_create(client, fx_dir,
> - fx_open_dir,
> debug);
> + if (vdagent_file_xfers != NULL) {
> + vdagent_file_xfers_destroy(vdagent_file_xfers);
> + vdagent_file_xfers = vdagent_file_xfers_create(client, fx_dir,
> + fx_open_dir,
> debug);
> + }
> break;
> default:
> syslog(LOG_ERR, "Unknown message from vdagentd type: %d,
> ignoring",
> @@ -298,7 +306,9 @@ reconnect:
> udscs_client_handle_fds(&client, &readfds, &writefds);
> }
>
> - vdagent_file_xfers_destroy(vdagent_file_xfers);
> + if (vdagent_file_xfers != NULL) {
> + vdagent_file_xfers_destroy(vdagent_file_xfers);
> + }
> vdagent_x11_destroy(x11, client == NULL);
> udscs_destroy_connection(&client);
> if (!quit && do_daemonize)
> --
> 1.9.0
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>
--
Marc-André Lureau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20140401/09a0e203/attachment.html>
More information about the Spice-devel
mailing list