* @brief Checks return value for error. * * Every value returned by a syscall is passed to this function. It returns 0 * if the return value is ok or -1 if there was an error. * If the macro `VERBOSE` is defined, an appropriate message is printed to * STDERR. * * @param return_value A return value from a syscall. * * @retval 0 The syscall was successful. * @retval -1 There was an error.
| 87 | * @retval -1 There was an error. |
| 88 | */ |
| 89 | static inline signed int check_error(int return_value) { |
| 90 | #ifdef VERBOSE |
| 91 | const char* errbuf; |
| 92 | #endif |
| 93 | if (return_value < 0) { |
| 94 | #ifdef VERBOSE |
| 95 | errbuf = strerror(errno); |
| 96 | debug_write(errbuf); |
| 97 | #endif |
| 98 | return -1; |
| 99 | } |
| 100 | |
| 101 | return 0; |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * @brief Create and connect a new UNIX STREAM socket. |
no outgoing calls
no test coverage detected