MCPcopy Create free account
hub / github.com/dermesser/libsocket / check_error

Function check_error

C/unix/libunixsocket.c:89–102  ·  view source on GitHub ↗

* @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.

Source from the content-addressed store, hash-verified

87 * @retval -1 There was an error.
88 */
89static 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.

Callers 9

create_unix_dgram_socketFunction · 0.70
destroy_unix_socketFunction · 0.70
sendto_unix_dgram_socketFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected