Fix bug #68571 : core dump when webserver close the socket

the bug is here: https://bugs.php.net/bug.php?id=68571

There is several conditions when core dump
1 don't use error_log in php.ini.
2 a lot of stderr log generate
3 webserver close the socket after send the request(request timeout will lead the action)

from the  code of php, we know that 
1 output is base a buffer(out_buf)
2 out_pos point to the last address, out_pos - out_buf <= 8192 (the buffer's length)
3 if out_hdr is NULL, we let out_pos add sizeof(fcgi_header)
4 before write data to client, we will reset out_hdr to NULL(in function close_packet)

but when write stderr to client failed, there are two mistake
1 we don't reset the pos of out_pos
2 we don't check the return value of fcgi_write

so out_pos  add more and more sizeof(fcgi_header) until address out of bounds and core dump

I rest the pos of out_pos and check the return value of fcgi_write in my PR
thank god, @laruence , you finally understand what I mean
But, we care about return value of cgi_write is not enough.
In php.ini,  if we use ignore_user_abort, according to its meaning,we must go on running the code, so I must rest the out_pos 
Yes, the problem is a  common problem