summaryrefslogtreecommitdiff
path: root/test/proc_child.c
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2002-11-27 12:30:18 +0000
committerJoe Orton <jorton@apache.org>2002-11-27 12:30:18 +0000
commite043cf97cd5c71876d860833d07e03d1bad630bf (patch)
tree5c1f87f9e582044f20f426a1a471fa1937adc64a /test/proc_child.c
parentf2e36fd765cd5ca44c970f5d34fabc32bb7f1d04 (diff)
downloadapr-e043cf97cd5c71876d860833d07e03d1bad630bf.tar.gz
Fix to not assume input is NUL-terminated.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64099 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/proc_child.c')
-rw-r--r--test/proc_child.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/proc_child.c b/test/proc_child.c
index 9b3fd1cf2..b3b6ddb93 100644
--- a/test/proc_child.c
+++ b/test/proc_child.c
@@ -8,9 +8,11 @@
int main(void)
{
char buf[256];
-
- read(STDIN_FILENO, buf, 256);
- fprintf(stdout, "%s", buf);
+ ssize_t bytes;
+
+ bytes = read(STDIN_FILENO, buf, 256);
+ if (bytes > 0)
+ write(STDOUT_FILENO, buf, bytes);
return 0; /* just to keep the compiler happy */
}