summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-01-03 20:41:20 +0100
committerLennart Poettering <lennart@poettering.net>2012-01-03 21:08:57 +0100
commitb72491a2fd8c237299055c636d4f748bca2b4b1f (patch)
tree56ab311d7c737f10f00a94b3329a6e569653342d /src
parent4f3656e1cec7fe3d7d3537e23a406cb88d734502 (diff)
nspawn: get rid of BUFFER_SIZE, use LINE_MAX instead
Diffstat (limited to 'src')
-rw-r--r--src/nspawn.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/nspawn.c b/src/nspawn.c
index 653d7db730..3ea603f235 100644
--- a/src/nspawn.c
+++ b/src/nspawn.c
@@ -394,11 +394,9 @@ static int is_os_tree(const char *path) {
return r < 0 ? 0 : 1;
}
-#define BUFFER_SIZE 1024
-
static int process_pty(int master, sigset_t *mask) {
- char in_buffer[BUFFER_SIZE], out_buffer[BUFFER_SIZE];
+ char in_buffer[LINE_MAX], out_buffer[LINE_MAX];
size_t in_buffer_full = 0, out_buffer_full = 0;
struct epoll_event stdin_ev, stdout_ev, master_ev, signal_ev;
bool stdin_readable = false, stdout_writable = false, master_readable = false, master_writable = false;
@@ -519,9 +517,9 @@ static int process_pty(int master, sigset_t *mask) {
(master_readable && out_buffer_full <= 0) ||
(stdout_writable && out_buffer_full > 0)) {
- if (stdin_readable && in_buffer_full < BUFFER_SIZE) {
+ if (stdin_readable && in_buffer_full < LINE_MAX) {
- if ((k = read(STDIN_FILENO, in_buffer + in_buffer_full, BUFFER_SIZE - in_buffer_full)) < 0) {
+ if ((k = read(STDIN_FILENO, in_buffer + in_buffer_full, LINE_MAX - in_buffer_full)) < 0) {
if (errno == EAGAIN || errno == EPIPE || errno == ECONNRESET || errno == EIO)
stdin_readable = false;
@@ -553,9 +551,9 @@ static int process_pty(int master, sigset_t *mask) {
}
}
- if (master_readable && out_buffer_full < BUFFER_SIZE) {
+ if (master_readable && out_buffer_full < LINE_MAX) {
- if ((k = read(master, out_buffer + out_buffer_full, BUFFER_SIZE - out_buffer_full)) < 0) {
+ if ((k = read(master, out_buffer + out_buffer_full, LINE_MAX - out_buffer_full)) < 0) {
if (errno == EAGAIN || errno == EPIPE || errno == ECONNRESET || errno == EIO)
master_readable = false;