qrexec: move set_nonblock function to write_stdin

It will be needed there.
This commit is contained in:
Rafal Wojtczuk 2011-03-17 17:53:33 +01:00
parent fb71bf968c
commit 53b517f6a5
4 changed files with 8 additions and 12 deletions

View File

@ -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);

View File

@ -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];

View File

@ -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;

View File

@ -22,6 +22,7 @@
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#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);
}