X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fnspawn.c;h=b8b379d9913d1fec63ff19ee53bf63a200119bbe;hb=1124fe6f01b1d59d016c238026f20380f38d98dc;hp=653d7db730a80361b08a2b002415c0cb2e6fcaa6;hpb=689b9a22f7fa89686b2b5240b7ee9f449dea5630;p=elogind.git diff --git a/src/nspawn.c b/src/nspawn.c index 653d7db73..b8b379d99 100644 --- a/src/nspawn.c +++ b/src/nspawn.c @@ -39,11 +39,12 @@ #include #include +#include + #include "log.h" #include "util.h" #include "missing.h" #include "cgroup-util.h" -#include "sd-daemon.h" #include "strv.h" #include "loopback-setup.h" @@ -394,11 +395,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 +518,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 +552,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;