diff options
author | Antenore Gatta (tmow) <antenore@simbiosi.org> | 2022-10-27 19:12:37 +0300 |
---|---|---|
committer | Antenore Gatta (tmow) <antenore@simbiosi.org> | 2022-10-27 19:12:37 +0300 |
commit | e7b382433197a2ea569dcc37c23a6d9f901c2527 (patch) | |
tree | 8e5618df2071e2d06412b7015b2bf12255941b3d | |
parent | d9151759475130e5123502c377e97f917970593d (diff) | |
parent | f25337ef0e4169b56d6a1206e5ba51b884dcc198 (diff) |
Merge branch 'fix_minor_compile_warning' into 'master'
Fix compile warnings and some spelling corrections
See merge request Remmina/Remmina!2434
-rw-r--r-- | src/remmina_ssh.c | 20 | ||||
-rw-r--r-- | src/remmina_ssh_plugin.c | 2 |
2 files changed, 12 insertions, 10 deletions
diff --git a/src/remmina_ssh.c b/src/remmina_ssh.c index eefc8ffe2..7ef32b95a 100644 --- a/src/remmina_ssh.c +++ b/src/remmina_ssh.c @@ -156,7 +156,7 @@ static int remmina_ssh_connect_local_xsocket(int display_number); static int remmina_ssh_x11_connect_display(); // Send data to channel -static int remimna_ssh_cp_to_ch_cb(int fd, int revents, void *userdata); +static int remmina_ssh_cp_to_ch_cb(int fd, int revents, void *userdata); // Read data from channel static int remmina_ssh_cp_to_fd_cb(ssh_session session, ssh_channel channel, void *data, uint32_t len, int is_stderr, void *userdata); @@ -474,11 +474,11 @@ remmina_ssh_x11_connect_display() } static int -remimna_ssh_cp_to_ch_cb(int fd, int revents, void *userdata) +remmina_ssh_cp_to_ch_cb(int fd, int revents, void *userdata) { TRACE_CALL(__func__); ssh_channel channel = (ssh_channel)userdata; - gchar buf[2097152]; + gchar buf[0x200000]; gint sz = 0, ret = 0; node_t *temp_node = remmina_ssh_search_item(channel); @@ -497,6 +497,8 @@ remimna_ssh_cp_to_ch_cb(int fd, int revents, void *userdata) sz = read(fd, buf, sizeof(buf)); if (sz > 0) { ret = ssh_channel_write(channel, buf, sz); + if (ret != sz) + return -1; //TODO: too verbose REMMINA_DEBUG("ssh_channel_write ret: %d sz: %d", ret, sz); } else if (sz < 0) { // TODO: too verbose REMMINA_WARNING("fd bytes read: %d", sz); @@ -515,10 +517,10 @@ remimna_ssh_cp_to_ch_cb(int fd, int revents, void *userdata) if ((revents & POLLHUP) || (revents & POLLNVAL) || (revents & POLLERR)) { REMMINA_DEBUG("Closing channel."); ssh_channel_close(channel); - sz = -1; + ret = -1; } - return sz; + return ret; } static int @@ -527,10 +529,10 @@ remmina_ssh_cp_to_fd_cb(ssh_session session, ssh_channel channel, void *data, ui TRACE_CALL(__func__); (void)session; (void)is_stderr; + // Expecting userdata to be type RemminaSSHShell *, but it is unused + // in this function. (void)userdata; -// RemminaSSHShell *shell = (RemminaSSHShell *)userdata; - node_t *temp_node = remmina_ssh_search_item(channel); gint fd = temp_node->fd_out; gint sz = 0; @@ -604,7 +606,7 @@ remmina_ssh_x11_open_request_cb(ssh_session session, const char *shost, int spor remmina_ssh_insert_item(channel, sock, sock, FALSE, shell->thread); - ssh_event_add_fd(shell->event, sock, events, remimna_ssh_cp_to_ch_cb, channel); + ssh_event_add_fd(shell->event, sock, events, remmina_ssh_cp_to_ch_cb, channel); ssh_event_add_session(shell->event, session); ssh_add_channel_callbacks(channel, &channel_cb); @@ -2969,7 +2971,7 @@ remmina_ssh_shell_thread(gpointer data) REMMINA_DEBUG("shell->slave: %d", shell->slave); // Add the fd to the event and assign it the callback. - if (ssh_event_add_fd(shell->event, shell->slave, events, remimna_ssh_cp_to_ch_cb, channel) != SSH_OK) { + if (ssh_event_add_fd(shell->event, shell->slave, events, remmina_ssh_cp_to_ch_cb, channel) != SSH_OK) { REMMINA_WARNING("Internal error in %s: Couldn't add an fd to the event.", __func__); return NULL; } diff --git a/src/remmina_ssh_plugin.c b/src/remmina_ssh_plugin.c index f78981371..c9b74f6ee 100644 --- a/src/remmina_ssh_plugin.c +++ b/src/remmina_ssh_plugin.c @@ -1263,7 +1263,7 @@ remmina_plugin_ssh_init(RemminaProtocolWidget *gp) sshlogname = remmina_file_format_properties(remminafile, sshlogname); fp = g_strconcat(dir, "/", sshlogname, NULL); - g_free(sshlogname); + g_free((gpointer) sshlogname); gpdata->vte_session_file = g_file_new_for_path(fp); g_free(fp); |