struct TunnelSockData
{
pid_t pid;
- int readfd;
- int writefd;
+ int fd_read;
+ int fd_write;
};
/**
fcntl(pin[0], F_SETFD, FD_CLOEXEC);
fcntl(pout[1], F_SETFD, FD_CLOEXEC);
- tunnel->readfd = pin[0];
- tunnel->writefd = pout[1];
+ tunnel->fd_read = pin[0];
+ tunnel->fd_write = pout[1];
tunnel->pid = pid;
conn->fd = 42; /* stupid hack */
do
{
- rc = read(tunnel->readfd, buf, count);
+ rc = read(tunnel->fd_read, buf, count);
} while (rc < 0 && errno == EINTR);
if (rc < 0)
{
do
{
- rc = write(tunnel->writefd, buf + sent, count - sent);
+ rc = write(tunnel->fd_write, buf + sent, count - sent);
} while (rc < 0 && errno == EINTR);
if (rc < 0)
int rc;
ofd = conn->fd;
- conn->fd = tunnel->readfd;
+ conn->fd = tunnel->fd_read;
rc = raw_socket_poll(conn, wait_secs);
conn->fd = ofd;
struct TunnelSockData *tunnel = conn->sockdata;
int status;
- close(tunnel->readfd);
- close(tunnel->writefd);
+ close(tunnel->fd_read);
+ close(tunnel->fd_write);
waitpid(tunnel->pid, &status, 0);
if (!WIFEXITED(status) || WEXITSTATUS(status))
{