ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtd.C
(Generate patch)

Comparing rxvt-unicode/src/rxvtd.C (file contents):
Revision 1.34 by root, Sun Nov 11 04:08:00 2007 UTC vs.
Revision 1.36 by root, Sat Nov 17 07:28:00 2007 UTC

50 server (int fd) 50 server (int fd)
51 : read_ev (this, &server::read_cb), 51 : read_ev (this, &server::read_cb),
52 log_cb (this, &server::log_msg), 52 log_cb (this, &server::log_msg),
53 getfd_cb (this, &server::getfd) 53 getfd_cb (this, &server::getfd)
54 { 54 {
55 this->fd = fd; 55 fcntl (fd, F_SETFD, FD_CLOEXEC);
56 fcntl (fd, F_SETFL, 0);
56 read_ev.start (fd, ev::READ); 57 read_ev.start (fd, ev::READ);
57 } 58 }
58 59
59 void err (const char *format = 0, ...); 60 void err (const char *format = 0, ...);
60}; 61};
83 perror ("unable to create listening socket"); 84 perror ("unable to create listening socket");
84 exit (EXIT_FAILURE); 85 exit (EXIT_FAILURE);
85 } 86 }
86 87
87 fcntl (fd, F_SETFD, FD_CLOEXEC); 88 fcntl (fd, F_SETFD, FD_CLOEXEC);
89 fcntl (fd, F_SETFL, O_NONBLOCK);
88 90
89 sa.sun_family = AF_UNIX; 91 sa.sun_family = AF_UNIX;
90 strcpy (sa.sun_path, sockname); 92 strcpy (sa.sun_path, sockname);
91 93
92 unlink (rxvt_connection::unix_sockname ()); 94 unlink (rxvt_connection::unix_sockname ());
113void unix_listener::accept_cb (ev::io &w, int revents) 115void unix_listener::accept_cb (ev::io &w, int revents)
114{ 116{
115 int fd2 = accept (fd, 0, 0); 117 int fd2 = accept (fd, 0, 0);
116 118
117 if (fd2 >= 0) 119 if (fd2 >= 0)
118 {
119 fcntl (fd2, F_SETFD, FD_CLOEXEC);
120 new server (fd2); 120 new server (fd2);
121 }
122} 121}
123 122
124int server::getfd (int remote_fd) 123int server::getfd (int remote_fd)
125{ 124{
126 send ("GETFD"); 125 send ("GETFD");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines