* @brief Accept connections on a passive UNIX socket * * @param sfd The server socket * @param flags Flags for `accept4(3)` (therefore useless on any other system * than Linux) * * @retval >0 Return value is a socket connected to the client * @retval <0 Error at `accept[4]()` */
| 365 | * @retval <0 Error at `accept[4]()` |
| 366 | */ |
| 367 | int accept_unix_stream_socket(int sfd, int flags) { |
| 368 | int cfd; |
| 369 | |
| 370 | if (sfd < 0) return -1; |
| 371 | #if LIBSOCKET_LINUX |
| 372 | if (-1 == check_error(cfd = accept4(sfd, 0, 0, flags))) return -1; |
| 373 | #else |
| 374 | if (-1 == check_error(cfd = accept(sfd, 0, 0))) return -1; |
| 375 | #endif |
| 376 | return cfd; |
| 377 | } |
| 378 | |
| 379 | /** |
| 380 | * @brief Receive datagram from another UNIX socket |
no test coverage detected