You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Justin Erenkrantz <je...@apache.org> on 2002/11/27 19:00:26 UTC
Re: cvs commit: apr/test proc_child.c
--On Wednesday, November 27, 2002 12:30 PM +0000 jorton@apache.org
wrote:
> jorton 2002/11/27 04:30:18
>
> Modified: test proc_child.c
> Log:
> Fix to not assume input is NUL-terminated.
>
> Revision Changes Path
> 1.2 +5 -3 apr/test/proc_child.c
>
> Index: proc_child.c
>
> ===================================================================
> RCS file: /home/cvs/apr/test/proc_child.c,v
> retrieving revision 1.1
> retrieving revision 1.2
> diff -u -r1.1 -r1.2
> --- proc_child.c 26 Nov 2002 16:09:56 -0000 1.1
> +++ proc_child.c 27 Nov 2002 12:30:18 -0000 1.2
> @@ -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);
No tabs, please. -- justin