From 20a149b2c7bfd7e53d24d0665281c083d7362c67 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Fri, 12 Oct 2007 00:01:33 +0000 Subject: malloc over fatty buffers --- src/runscript.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/runscript.c') diff --git a/src/runscript.c b/src/runscript.c index ee49be7e..852194bb 100644 --- a/src/runscript.c +++ b/src/runscript.c @@ -376,7 +376,7 @@ static bool svc_exec (const char *arg1, const char *arg2) int flags = 0; fd_set rset; int s; - char buffer[RC_LINEBUFFER]; + char *buffer; size_t bytes; bool prefixed = false; int selfd; @@ -437,6 +437,7 @@ static bool svc_exec (const char *arg1, const char *arg2) } selfd = MAX (master_tty, signal_pipe[0]) + 1; + buffer = xmalloc (sizeof (char) * RC_LINEBUFFER); while (1) { FD_ZERO (&rset); FD_SET (signal_pipe[0], &rset); @@ -456,12 +457,13 @@ static bool svc_exec (const char *arg1, const char *arg2) break; if (master_tty >= 0 && FD_ISSET (master_tty, &rset)) { - bytes = read (master_tty, buffer, sizeof (buffer)); + bytes = read (master_tty, buffer, RC_LINEBUFFER); write_prefix (buffer, bytes, &prefixed); } } } - + + free (buffer); close (signal_pipe[0]); close (signal_pipe[1]); signal_pipe[0] = signal_pipe[1] = -1; -- cgit v1.2.3