a couple of changes to where the nonblocking settings are called.
authorAndrew Tridgell <tridge@samba.org>
Thu, 27 Aug 1998 05:05:14 +0000 (05:05 +0000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 27 Aug 1998 05:05:14 +0000 (05:05 +0000)
clientserver.c
main.c
socket.c
util.c

index 3266da5..955be24 100644 (file)
@@ -392,6 +392,9 @@ int daemon_main(void)
                        close(i); 
                        open("/dev/null", O_RDWR);
                }
+
+               set_nonblocking(STDIN_FILENO);
+
                return start_daemon(STDIN_FILENO);
        }
 
diff --git a/main.c b/main.c
index 2cd5912..a2df930 100644 (file)
--- a/main.c
+++ b/main.c
@@ -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)
index 674e3d7..6551df4 100644 (file)
--- a/socket.c
+++ b/socket.c
@@ -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));
                }
 
diff --git a/util.c b/util.c
index cc626d7..70743a6 100644 (file)
--- a/util.c
+++ b/util.c
@@ -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;
 }