1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-04-18 03:28:07 -05:00

unix: make uxsel callback functions return void.

Nothing used their return values anyway.  At least, not after the
previous commit.
This commit is contained in:
Ben Harris 2016-05-30 22:52:30 +01:00
parent 30cdaa7ca8
commit d56496c31c
6 changed files with 30 additions and 43 deletions

View File

@ -180,7 +180,7 @@ void postmsg(struct termios *);
/* The interface used by uxsel.c */ /* The interface used by uxsel.c */
typedef struct uxsel_id uxsel_id; typedef struct uxsel_id uxsel_id;
void uxsel_init(void); void uxsel_init(void);
typedef int (*uxsel_callback_fn)(int fd, int event); typedef void (*uxsel_callback_fn)(int fd, int event);
void uxsel_set(int fd, int rwx, uxsel_callback_fn callback); void uxsel_set(int fd, int rwx, uxsel_callback_fn callback);
void uxsel_del(int fd); void uxsel_del(int fd);
void select_result(int fd, int event); void select_result(int fd, int event);

View File

@ -98,7 +98,7 @@ void agent_cancel_query(agent_pending_query *conn)
sfree(conn); sfree(conn);
} }
static int agent_select_result(int fd, int event) static void agent_select_result(int fd, int event)
{ {
agent_pending_query *conn; agent_pending_query *conn;
@ -107,11 +107,11 @@ static int agent_select_result(int fd, int event)
conn = find234(agent_pending_queries, &fd, agent_connfind); conn = find234(agent_pending_queries, &fd, agent_connfind);
if (!conn) { if (!conn) {
uxsel_del(fd); uxsel_del(fd);
return 1; return;
} }
if (!agent_try_read(conn)) if (!agent_try_read(conn))
return 0; /* more data to come */ return; /* more data to come */
/* /*
* We have now completed the agent query. Do the callback, and * We have now completed the agent query. Do the callback, and
@ -120,7 +120,6 @@ static int agent_select_result(int fd, int event)
*/ */
conn->callback(conn->callback_ctx, conn->retbuf, conn->retlen); conn->callback(conn->callback_ctx, conn->retbuf, conn->retlen);
agent_cancel_query(conn); agent_cancel_query(conn);
return 0;
} }
agent_pending_query *agent_query( agent_pending_query *agent_query(

View File

@ -1266,7 +1266,7 @@ static void sk_tcp_write_eof(Socket sock)
uxsel_tell(s); uxsel_tell(s);
} }
static int net_select_result(int fd, int event) static void net_select_result(int fd, int event)
{ {
int ret; int ret;
char buf[20480]; /* nice big buffer for plenty of speed */ char buf[20480]; /* nice big buffer for plenty of speed */
@ -1276,7 +1276,7 @@ static int net_select_result(int fd, int event)
/* Find the Socket structure */ /* Find the Socket structure */
s = find234(sktree, &fd, cmpforsearch); s = find234(sktree, &fd, cmpforsearch);
if (!s) if (!s)
return 1; /* boggle */ return; /* boggle */
noise_ultralight(event); noise_ultralight(event);
@ -1292,9 +1292,9 @@ static int net_select_result(int fd, int event)
ret = recv(s->s, buf, sizeof(buf), MSG_OOB); ret = recv(s->s, buf, sizeof(buf), MSG_OOB);
noise_ultralight(ret); noise_ultralight(ret);
if (ret <= 0) { if (ret <= 0) {
return plug_closing(s->plug, plug_closing(s->plug,
ret == 0 ? "Internal networking trouble" : ret == 0 ? "Internal networking trouble" :
strerror(errno), errno, 0); strerror(errno), errno, 0);
} else { } else {
/* /*
* Receiving actual data on a socket means we can * Receiving actual data on a socket means we can
@ -1305,7 +1305,7 @@ static int net_select_result(int fd, int event)
sk_addr_free(s->addr); sk_addr_free(s->addr);
s->addr = NULL; s->addr = NULL;
} }
return plug_receive(s->plug, 2, buf, ret); plug_receive(s->plug, 2, buf, ret);
} }
break; break;
} }
@ -1377,11 +1377,11 @@ static int net_select_result(int fd, int event)
} }
} }
if (ret < 0) { if (ret < 0) {
return plug_closing(s->plug, strerror(errno), errno, 0); plug_closing(s->plug, strerror(errno), errno, 0);
} else if (0 == ret) { } else if (0 == ret) {
s->incomingeof = TRUE; /* stop trying to read now */ s->incomingeof = TRUE; /* stop trying to read now */
uxsel_tell(s); uxsel_tell(s);
return plug_closing(s->plug, NULL, 0, 0); plug_closing(s->plug, NULL, 0, 0);
} else { } else {
/* /*
* Receiving actual data on a socket means we can * Receiving actual data on a socket means we can
@ -1392,7 +1392,7 @@ static int net_select_result(int fd, int event)
sk_addr_free(s->addr); sk_addr_free(s->addr);
s->addr = NULL; s->addr = NULL;
} }
return plug_receive(s->plug, atmark ? 0 : 1, buf, ret); plug_receive(s->plug, atmark ? 0 : 1, buf, ret);
} }
break; break;
case 2: /* writable */ case 2: /* writable */
@ -1430,9 +1430,9 @@ static int net_select_result(int fd, int event)
err = try_connect(s); err = try_connect(s);
} }
if (err) if (err)
return plug_closing(s->plug, strerror(err), err, 0); plug_closing(s->plug, strerror(err), err, 0);
if (!s->connected) if (!s->connected)
return 0; /* another async attempt in progress */ return; /* another async attempt in progress */
} }
} }
@ -1456,8 +1456,6 @@ static int net_select_result(int fd, int event)
} }
break; break;
} }
return 1;
} }
/* /*

View File

@ -33,7 +33,7 @@ struct Socket_localproxy_tag {
enum { EOF_NO, EOF_PENDING, EOF_SENT } outgoingeof; enum { EOF_NO, EOF_PENDING, EOF_SENT } outgoingeof;
}; };
static int localproxy_select_result(int fd, int event); static void localproxy_select_result(int fd, int event);
/* /*
* Trees to look up the pipe fds in. * Trees to look up the pipe fds in.
@ -229,7 +229,7 @@ static const char * sk_localproxy_socket_error (Socket s)
return ps->error; return ps->error;
} }
static int localproxy_select_result(int fd, int event) static void localproxy_select_result(int fd, int event)
{ {
Local_Proxy_Socket s; Local_Proxy_Socket s;
char buf[20480]; char buf[20480];
@ -238,7 +238,7 @@ static int localproxy_select_result(int fd, int event)
if (!(s = find234(localproxy_by_fromfd, &fd, localproxy_fromfd_find)) && if (!(s = find234(localproxy_by_fromfd, &fd, localproxy_fromfd_find)) &&
!(s = find234(localproxy_by_fromfd, &fd, localproxy_errfd_find)) && !(s = find234(localproxy_by_fromfd, &fd, localproxy_errfd_find)) &&
!(s = find234(localproxy_by_tofd, &fd, localproxy_tofd_find)) ) !(s = find234(localproxy_by_tofd, &fd, localproxy_tofd_find)) )
return 1; /* boggle */ return; /* boggle */
if (event == 1) { if (event == 1) {
if (fd == s->cmd_err) { if (fd == s->cmd_err) {
@ -249,21 +249,18 @@ static int localproxy_select_result(int fd, int event)
assert(fd == s->from_cmd); assert(fd == s->from_cmd);
ret = read(fd, buf, sizeof(buf)); ret = read(fd, buf, sizeof(buf));
if (ret < 0) { if (ret < 0) {
return plug_closing(s->plug, strerror(errno), errno, 0); plug_closing(s->plug, strerror(errno), errno, 0);
} else if (ret == 0) { } else if (ret == 0) {
return plug_closing(s->plug, NULL, 0, 0); plug_closing(s->plug, NULL, 0, 0);
} else { } else {
return plug_receive(s->plug, 0, buf, ret); plug_receive(s->plug, 0, buf, ret);
} }
} }
} else if (event == 2) { } else if (event == 2) {
assert(fd == s->to_cmd); assert(fd == s->to_cmd);
if (localproxy_try_send(s)) if (localproxy_try_send(s))
plug_sent(s->plug, bufchain_size(&s->pending_output_data)); plug_sent(s->plug, bufchain_size(&s->pending_output_data));
return 1;
} }
return 1;
} }
Socket platform_new_connection(SockAddr addr, const char *hostname, Socket platform_new_connection(SockAddr addr, const char *hostname,

View File

@ -572,7 +572,7 @@ void pty_pre_init(void)
} }
int pty_real_select_result(Pty pty, int event, int status) void pty_real_select_result(Pty pty, int event, int status)
{ {
char buf[4096]; char buf[4096];
int ret; int ret;
@ -672,13 +672,10 @@ int pty_real_select_result(Pty pty, int event, int status)
notify_remote_exit(pty->frontend); notify_remote_exit(pty->frontend);
} }
return !finished;
} }
int pty_select_result(int fd, int event) void pty_select_result(int fd, int event)
{ {
int ret = TRUE;
Pty pty; Pty pty;
if (fd == pty_signal_pipe[0]) { if (fd == pty_signal_pipe[0]) {
@ -696,16 +693,14 @@ int pty_select_result(int fd, int event)
pty = find234(ptys_by_pid, &pid, pty_find_by_pid); pty = find234(ptys_by_pid, &pid, pty_find_by_pid);
if (pty) if (pty)
ret = ret && pty_real_select_result(pty, -1, status); pty_real_select_result(pty, -1, status);
} while (pid > 0); } while (pid > 0);
} else { } else {
pty = find234(ptys_by_fd, &fd, pty_find_by_fd); pty = find234(ptys_by_fd, &fd, pty_find_by_fd);
if (pty) if (pty)
ret = ret && pty_real_select_result(pty, event, 0); pty_real_select_result(pty, event, 0);
} }
return ret;
} }
static void pty_uxsel_setup(Pty pty) static void pty_uxsel_setup(Pty pty)

View File

@ -56,7 +56,7 @@ static int serial_find_by_fd(void *av, void *bv)
static tree234 *serial_by_fd = NULL; static tree234 *serial_by_fd = NULL;
static int serial_select_result(int fd, int event); static void serial_select_result(int fd, int event);
static void serial_uxsel_setup(Serial serial); static void serial_uxsel_setup(Serial serial);
static void serial_try_write(Serial serial); static void serial_try_write(Serial serial);
@ -366,7 +366,7 @@ static void serial_reconfig(void *handle, Conf *conf)
serial_configure(serial, conf); serial_configure(serial, conf);
} }
static int serial_select_result(int fd, int event) static void serial_select_result(int fd, int event)
{ {
Serial serial; Serial serial;
char buf[4096]; char buf[4096];
@ -376,7 +376,7 @@ static int serial_select_result(int fd, int event)
serial = find234(serial_by_fd, &fd, serial_find_by_fd); serial = find234(serial_by_fd, &fd, serial_find_by_fd);
if (!serial) if (!serial)
return 1; /* spurious event; keep going */ return; /* spurious event; keep going */
if (event == 1) { if (event == 1) {
ret = read(serial->fd, buf, sizeof(buf)); ret = read(serial->fd, buf, sizeof(buf));
@ -391,11 +391,11 @@ static int serial_select_result(int fd, int event)
} else if (ret < 0) { } else if (ret < 0) {
#ifdef EAGAIN #ifdef EAGAIN
if (errno == EAGAIN) if (errno == EAGAIN)
return 1; /* spurious */ return; /* spurious */
#endif #endif
#ifdef EWOULDBLOCK #ifdef EWOULDBLOCK
if (errno == EWOULDBLOCK) if (errno == EWOULDBLOCK)
return 1; /* spurious */ return; /* spurious */
#endif #endif
perror("read serial port"); perror("read serial port");
exit(1); exit(1);
@ -417,8 +417,6 @@ static int serial_select_result(int fd, int event)
notify_remote_exit(serial->frontend); notify_remote_exit(serial->frontend);
} }
return !finished;
} }
static void serial_uxsel_setup(Serial serial) static void serial_uxsel_setup(Serial serial)