aboutsummaryrefslogtreecommitdiff
path: root/src/runscript.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/runscript.c')
-rw-r--r--src/runscript.c8
1 files changed, 5 insertions, 3 deletions
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;