summaryrefslogtreecommitdiff
path: root/src/runscript.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-10-12 00:01:33 +0000
committerRoy Marples <roy@marples.name>2007-10-12 00:01:33 +0000
commit20a149b2c7bfd7e53d24d0665281c083d7362c67 (patch)
treeb195111871b8e05c584b71aed066c3990c5db2b3 /src/runscript.c
parente3bc6666d6d5bd8922ca10652a2d04577357fa71 (diff)
downloadopenrc-20a149b2c7bfd7e53d24d0665281c083d7362c67.tar.gz
openrc-20a149b2c7bfd7e53d24d0665281c083d7362c67.tar.bz2
openrc-20a149b2c7bfd7e53d24d0665281c083d7362c67.tar.xz
malloc over fatty buffers
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 ee49be7..852194b 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;