Allow server_start to accept a NULL argument

Return 1 if the endpoint argument is NULL, server_start() can get
a NULL value when using server_address_new() or vim_tempname(). Removed
the function attribute.
This commit is contained in:
Rui Abreu Ferreira
2015-10-02 00:24:20 +01:00
parent 5161f447f6
commit 3e84a91ac1

View File

@@ -101,8 +101,12 @@ char *server_address_new(void)
/// @returns 0 on success, 1 on a regular error, and negative errno /// @returns 0 on success, 1 on a regular error, and negative errno
/// on failure to bind or connect. /// on failure to bind or connect.
int server_start(const char *endpoint) int server_start(const char *endpoint)
FUNC_ATTR_NONNULL_ALL
{ {
if (endpoint == NULL) {
ELOG("Attempting to start server on NULL endpoint");
return 1;
}
SocketWatcher *watcher = xmalloc(sizeof(SocketWatcher)); SocketWatcher *watcher = xmalloc(sizeof(SocketWatcher));
socket_watcher_init(&loop, watcher, endpoint, NULL); socket_watcher_init(&loop, watcher, endpoint, NULL);