Commit 3eb38818 authored by Andrew Tridgell's avatar Andrew Tridgell

a couple of changes to where the nonblocking settings are called.

parent 858fb9eb
......@@ -392,6 +392,9 @@ int daemon_main(void)
close(i);
open("/dev/null", O_RDWR);
}
set_nonblocking(STDIN_FILENO);
return start_daemon(STDIN_FILENO);
}
......
......@@ -250,15 +250,15 @@ static void do_server_sender(int f_in, int f_out, int argc,char *argv[])
argv[0] = ".";
}
set_nonblocking(f_out);
if (f_in != f_out)
set_nonblocking(f_in);
flist = send_file_list(f_out,argc,argv);
if (!flist || flist->count == 0) {
exit_cleanup(0);
}
set_nonblocking(f_out);
if (f_in != f_out)
set_nonblocking(f_in);
send_files(flist,f_out,f_in);
report(f_out);
io_flush();
......@@ -288,6 +288,7 @@ static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
if (f_in != f_out) close(f_out);
set_nonblocking(f_in);
set_nonblocking(recv_pipe[1]);
recv_files(f_in,flist,local_name,recv_pipe[1]);
report(f_in);
......@@ -301,6 +302,7 @@ static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
if (f_in != f_out) close(f_in);
set_nonblocking(f_out);
set_nonblocking(recv_pipe[0]);
io_start_buffering(f_out);
......@@ -362,8 +364,12 @@ void start_server(int f_in, int f_out, int argc, char *argv[])
extern int cvs_exclude;
extern int am_sender;
set_nonblocking(f_out);
if (f_in != f_out)
set_nonblocking(f_in);
setup_protocol(f_out, f_in);
if (am_sender) {
recv_exclude_list(f_in);
if (cvs_exclude)
......
......@@ -54,6 +54,8 @@ int open_socket_out(char *host, int port)
return -1;
}
set_nonblocking(res);
return res;
}
......@@ -110,9 +112,9 @@ determine if a file descriptor is in fact a socket
****************************************************************************/
int is_a_socket(int fd)
{
int v,l;
l = sizeof(int);
return(getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&v, &l) == 0);
int v,l;
l = sizeof(int);
return(getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&v, &l) == 0);
}
......@@ -165,6 +167,8 @@ void start_accept_loop(int port, int (*fn)(int ))
if (fork()==0) {
close(s);
set_nonblocking(fd);
_exit(fn(fd));
}
......
......@@ -98,6 +98,9 @@ int piped_child(char **command,int *f_in,int *f_out)
*f_in = from_child_pipe[0];
*f_out = to_child_pipe[1];
set_nonblocking(*f_in);
set_nonblocking(*f_out);
return pid;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment