From 53b517f6a57a2cd5ba60910f62b5461281429d76 Mon Sep 17 00:00:00 2001 From: Rafal Wojtczuk Date: Thu, 17 Mar 2011 17:53:33 +0100 Subject: [PATCH] qrexec: move set_nonblock function to write_stdin It will be needed there. --- qrexec/glue.h | 1 + qrexec/qrexec_agent.c | 6 ------ qrexec/qrexec_daemon.c | 6 ------ qrexec/write_stdin.c | 7 +++++++ 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/qrexec/glue.h b/qrexec/glue.h index 81c6c9e5..03bb6c15 100644 --- a/qrexec/glue.h +++ b/qrexec/glue.h @@ -44,3 +44,4 @@ enum { int flush_client_data(int fd, int clid, struct buffer *buffer); int write_stdin(int fd, int clid, char *data, int len, struct buffer *buffer); +void set_nonblock(int fd); diff --git a/qrexec/qrexec_agent.c b/qrexec/qrexec_agent.c index 8bc6e014..bace294f 100644 --- a/qrexec/qrexec_agent.c +++ b/qrexec/qrexec_agent.c @@ -143,12 +143,6 @@ void handle_just_exec(int clid, int len) fprintf(stderr, "executed (nowait) %s pid %d\n", buf, pid); } -void set_nonblock(int fd) -{ - int fl = fcntl(fd, F_GETFL, 0); - fcntl(fd, F_SETFL, fl | O_NONBLOCK); -} - void handle_exec(int clid, int len) { char buf[len]; diff --git a/qrexec/qrexec_daemon.c b/qrexec/qrexec_daemon.c index 8507c90f..051103ca 100644 --- a/qrexec/qrexec_daemon.c +++ b/qrexec/qrexec_daemon.c @@ -148,12 +148,6 @@ void pass_to_agent(int fd, struct server_header *s_hdr) write_all_vchan_ext(buf, len); } -void set_nonblock(int fd) -{ - int fl = fcntl(fd, F_GETFL, 0); - fcntl(fd, F_SETFL, fl | O_NONBLOCK); -} - void handle_client_cmdline(int fd) { struct client_header hdr; diff --git a/qrexec/write_stdin.c b/qrexec/write_stdin.c index 9da24bed..bb5a40a6 100644 --- a/qrexec/write_stdin.c +++ b/qrexec/write_stdin.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "qrexec.h" #include "buffer.h" #include "glue.h" @@ -89,3 +90,9 @@ int write_stdin(int fd, int clid, char *data, int len, } } + +void set_nonblock(int fd) +{ + int fl = fcntl(fd, F_GETFL, 0); + fcntl(fd, F_SETFL, fl | O_NONBLOCK); +}