--- rxvt-unicode/src/rxvtd.C 2005/07/07 19:37:47 1.21 +++ rxvt-unicode/src/rxvtd.C 2006/01/17 15:17:39 1.24 @@ -23,6 +23,7 @@ #include "../config.h" #include "rxvt.h" #include "rxvtdaemon.h" +#include "fdpass.h" #include "iom.h" #include @@ -43,13 +44,16 @@ struct server : rxvt_connection { log_callback log_cb; + getfd_callback getfd_cb; void read_cb (io_watcher &w, short revents); io_watcher read_ev; void log_msg (const char *msg); + int getfd (int remote_fd); server (int fd) : read_ev (this, &server::read_cb), - log_cb (this, &server::log_msg) + log_cb (this, &server::log_msg), + getfd_cb (this, &server::getfd) { this->fd = fd; read_ev.start (fd, EVENT_READ); @@ -69,7 +73,7 @@ unix_listener::unix_listener (const char *sockname) : accept_ev (this, &unix_listener::accept_cb) { - if ((fd = socket (PF_UNIX, SOCK_STREAM, 0)) < 0) + if ((fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) { perror ("unable to create listening socket"); exit (EXIT_FAILURE); @@ -114,6 +118,13 @@ } } +int server::getfd (int remote_fd) +{ + send ("GETFD"); + send (remote_fd); + return rxvt_recv_fd (fd); +} + void server::log_msg (const char *msg) { send ("MSG"), send (msg); @@ -173,12 +184,10 @@ envv->push_back (0); { - char **old_environ = environ; - environ = envv->begin (); - rxvt_term *term = new rxvt_term; term->log_hook = &log_cb; + term->getfd_hook = &getfd_cb; term->argv = argv; term->envv = envv; @@ -195,7 +204,6 @@ term->log_hook = 0; - environ = old_environ; chdir ("/"); if (!success)