@@ -78,6 +78,7 @@ int raw_sock_to_pipe(struct connection *conn, void *xprt_ctx, struct pipe *pipe,
7878 /* report error on POLL_ERR before connection establishment */
7979 if ((fdtab [conn -> handle .fd ].state & FD_POLL_ERR ) && (conn -> flags & CO_FL_WAIT_L4_CONN )) {
8080 conn -> flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH ;
81+ conn_set_errcode (conn , CO_ER_POLLERR );
8182 errno = 0 ; /* let the caller do a getsockopt() if it wants it */
8283 goto leave ;
8384 }
@@ -127,6 +128,7 @@ int raw_sock_to_pipe(struct connection *conn, void *xprt_ctx, struct pipe *pipe,
127128 }
128129 /* here we have another error */
129130 conn -> flags |= CO_FL_ERROR ;
131+ conn_set_errno (conn , errno );
130132 break ;
131133 } /* ret <= 0 */
132134
@@ -176,6 +178,7 @@ int raw_sock_from_pipe(struct connection *conn, void *xprt_ctx, struct pipe *pip
176178 /* it's already closed */
177179 conn -> flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH ;
178180 errno = EPIPE ;
181+ conn_set_errno (conn , errno );
179182 return 0 ;
180183 }
181184
@@ -197,6 +200,7 @@ int raw_sock_from_pipe(struct connection *conn, void *xprt_ctx, struct pipe *pip
197200
198201 /* here we have another error */
199202 conn -> flags |= CO_FL_ERROR ;
203+ conn_set_errno (conn , errno );
200204 break ;
201205 }
202206
@@ -248,6 +252,7 @@ static size_t raw_sock_to_buf(struct connection *conn, void *xprt_ctx, struct bu
248252 /* report error on POLL_ERR before connection establishment */
249253 if ((fdtab [conn -> handle .fd ].state & FD_POLL_ERR ) && (conn -> flags & CO_FL_WAIT_L4_CONN )) {
250254 conn -> flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH ;
255+ conn_set_errcode (conn , CO_ER_POLLERR );
251256 goto leave ;
252257 }
253258 }
@@ -306,6 +311,7 @@ static size_t raw_sock_to_buf(struct connection *conn, void *xprt_ctx, struct bu
306311 }
307312 else if (errno != EINTR ) {
308313 conn -> flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH ;
314+ conn_set_errno (conn , errno );
309315 break ;
310316 }
311317 }
@@ -327,8 +333,10 @@ static size_t raw_sock_to_buf(struct connection *conn, void *xprt_ctx, struct bu
327333 * of recv()'s return value 0, so we have no way to tell there was
328334 * an error without checking.
329335 */
330- if (unlikely (!done && fdtab [conn -> handle .fd ].state & FD_POLL_ERR ))
336+ if (unlikely (!done && fdtab [conn -> handle .fd ].state & FD_POLL_ERR )) {
331337 conn -> flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH ;
338+ conn_set_errcode (conn , CO_ER_POLLERR );
339+ }
332340 goto leave ;
333341}
334342
@@ -361,6 +369,7 @@ static size_t raw_sock_from_buf(struct connection *conn, void *xprt_ctx, const s
361369 if (unlikely (fdtab [conn -> handle .fd ].state & FD_POLL_ERR )) {
362370 /* an error was reported on the FD, we can't send anymore */
363371 conn -> flags |= CO_FL_ERROR | CO_FL_SOCK_WR_SH | CO_FL_SOCK_RD_SH ;
372+ conn_set_errcode (conn , CO_ER_POLLERR );
364373 errno = EPIPE ;
365374 return 0 ;
366375 }
@@ -369,6 +378,7 @@ static size_t raw_sock_from_buf(struct connection *conn, void *xprt_ctx, const s
369378 /* it's already closed */
370379 conn -> flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH ;
371380 errno = EPIPE ;
381+ conn_set_errno (conn , errno );
372382 return 0 ;
373383 }
374384
@@ -407,6 +417,7 @@ static size_t raw_sock_from_buf(struct connection *conn, void *xprt_ctx, const s
407417 }
408418 else if (errno != EINTR ) {
409419 conn -> flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH ;
420+ conn_set_errno (conn , errno );
410421 break ;
411422 }
412423 }
0 commit comments