=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/server.c,v retrieving revision 1.12 retrieving revision 1.13 diff -c -r1.12 -r1.13 *** src/usr.bin/tmux/server.c 2009/07/20 14:37:51 1.12 --- src/usr.bin/tmux/server.c 2009/07/21 19:54:22 1.13 *************** *** 1,4 **** ! /* $OpenBSD: server.c,v 1.12 2009/07/20 14:37:51 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: server.c,v 1.13 2009/07/21 19:54:22 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 44,49 **** --- 44,50 ---- /* Client list. */ struct clients clients; + void server_create_client(int); int server_create_socket(void); int server_main(int); void server_shutdown(void); *************** *** 52,58 **** void server_handle_windows(struct pollfd **); void server_fill_clients(struct pollfd **); void server_handle_clients(struct pollfd **); ! struct client *server_accept_client(int); void server_handle_client(struct client *); void server_handle_window(struct window *, struct window_pane *); int server_check_window_bell(struct session *, struct window *); --- 53,59 ---- void server_handle_windows(struct pollfd **); void server_fill_clients(struct pollfd **); void server_handle_clients(struct pollfd **); ! void server_accept_client(int); void server_handle_client(struct client *); void server_handle_window(struct window *, struct window_pane *); int server_check_window_bell(struct session *, struct window *); *************** *** 69,75 **** int server_update_socket(void); /* Create a new client. */ ! struct client * server_create_client(int fd) { struct client *c; --- 70,76 ---- int server_update_socket(void); /* Create a new client. */ ! void server_create_client(int fd) { struct client *c; *************** *** 107,117 **** for (i = 0; i < ARRAY_LENGTH(&clients); i++) { if (ARRAY_ITEM(&clients, i) == NULL) { ARRAY_SET(&clients, i, c); ! return (c); } } ARRAY_ADD(&clients, c); - return (c); } /* Find client index. */ --- 108,117 ---- for (i = 0; i < ARRAY_LENGTH(&clients); i++) { if (ARRAY_ITEM(&clients, i) == NULL) { ARRAY_SET(&clients, i, c); ! return; } } ARRAY_ADD(&clients, c); } /* Find client index. */ *************** *** 735,741 **** } /* accept(2) and create new client. */ ! struct client * server_accept_client(int srv_fd) { struct sockaddr_storage sa; --- 735,741 ---- } /* accept(2) and create new client. */ ! void server_accept_client(int srv_fd) { struct sockaddr_storage sa; *************** *** 745,758 **** fd = accept(srv_fd, (struct sockaddr *) &sa, &slen); if (fd == -1) { if (errno == EAGAIN || errno == EINTR || errno == ECONNABORTED) ! return (NULL); fatal("accept failed"); } if (sigterm) { close(fd); ! return (NULL); } ! return (server_create_client(fd)); } /* Input data from client. */ --- 745,758 ---- fd = accept(srv_fd, (struct sockaddr *) &sa, &slen); if (fd == -1) { if (errno == EAGAIN || errno == EINTR || errno == ECONNABORTED) ! return; fatal("accept failed"); } if (sigterm) { close(fd); ! return; } ! server_create_client(fd); } /* Input data from client. */