X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/ff8b29b8c62f377ede40fbf0cbbaa428bd8df60a..8d9dc9f99db13d42272b7c150f2e6849331ccdc1:/socket.c diff --git a/socket.c b/socket.c index 5ee31f6d..910c2dc0 100644 --- a/socket.c +++ b/socket.c @@ -120,17 +120,17 @@ void start_accept_loop(int port, int (*fn)(int )) { int s; - signal(SIGCLD, SIG_IGN); + signal(SIGCHLD, SIG_IGN); /* open an incoming socket */ s = open_socket_in(SOCK_STREAM, port); if (s == -1) - exit(1); + exit_cleanup(1); /* ready to listen */ if (listen(s, 5) == -1) { close(s); - exit(1); + exit_cleanup(1); } @@ -216,6 +216,8 @@ set user socket options void set_socket_options(int fd, char *options) { char *tok; + if (!options || !*options) return; + options = strdup(options); if (!options) out_of_memory("set_socket_options"); @@ -306,7 +308,7 @@ char *client_addr(int fd) static char addr_buf[100]; if (getpeername(fd, &sa, &length)) { - exit(1); + exit_cleanup(1); } strlcpy(addr_buf,(char *)inet_ntoa(sockin->sin_addr), sizeof(addr_buf)-1); @@ -329,7 +331,7 @@ char *client_name(int fd) strcpy(name_buf,"UNKNOWN"); if (getpeername(fd, &sa, &length)) { - exit(1); + exit_cleanup(1); } /* Look up the remote host name. */