X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Funixsock.c;h=99e39eee4f39f0a771408c8a08bf09c750857282;hp=a42456896ef0142765a8f44ef0a30dd5679cfb71;hb=1159cb5d383c55a80a0db100b8f7aadcf44740a5;hpb=70cce90e376cd807d4dffc5864a8a7164d5f660d diff --git a/src/unixsock.c b/src/unixsock.c index a4245689..99e39eee 100644 --- a/src/unixsock.c +++ b/src/unixsock.c @@ -78,7 +78,7 @@ static int us_open_socket(void) { char errbuf[1024]; ERROR("unixsock plugin: socket failed: %s", sstrerror(errno, errbuf, sizeof(errbuf))); - return (-1); + return -1; } sa.sun_family = AF_UNIX; @@ -107,7 +107,7 @@ static int us_open_socket(void) { ERROR("unixsock plugin: bind failed: %s", errbuf); close(sock_fd); sock_fd = -1; - return (-1); + return -1; } status = chmod(sa.sun_path, sock_perms); @@ -117,7 +117,7 @@ static int us_open_socket(void) { sstrerror(errno, errbuf, sizeof(errbuf))); close(sock_fd); sock_fd = -1; - return (-1); + return -1; } status = listen(sock_fd, 8); @@ -127,7 +127,7 @@ static int us_open_socket(void) { sstrerror(errno, errbuf, sizeof(errbuf))); close(sock_fd); sock_fd = -1; - return (-1); + return -1; } do { @@ -166,7 +166,7 @@ static int us_open_socket(void) { } } while (0); - return (0); + return 0; } /* int us_open_socket */ static void *us_handle_client(void *arg) { @@ -197,7 +197,7 @@ static void *us_handle_client(void *arg) { close(fdin); close(fdout); pthread_exit((void *)1); - return ((void *)1); + return (void *)1; } fhout = fdopen(fdout, "w"); @@ -208,7 +208,7 @@ static void *us_handle_client(void *arg) { fclose(fhin); /* this closes fdin as well */ close(fdout); pthread_exit((void *)1); - return ((void *)1); + return (void *)1; } /* change output buffer to line buffered mode */ @@ -219,7 +219,7 @@ static void *us_handle_client(void *arg) { fclose(fhin); fclose(fhout); pthread_exit((void *)1); - return ((void *)0); + return (void *)0; } while (42) { @@ -259,7 +259,7 @@ static void *us_handle_client(void *arg) { fclose(fhin); fclose(fhout); pthread_exit((void *)1); - return ((void *)1); + return (void *)1; } if (strcasecmp(fields[0], "getval") == 0) { @@ -289,7 +289,7 @@ static void *us_handle_client(void *arg) { fclose(fhout); pthread_exit((void *)0); - return ((void *)0); + return (void *)0; } /* void *us_handle_client */ static void *us_server_thread(void __attribute__((unused)) * arg) { @@ -357,21 +357,21 @@ static void *us_server_thread(void __attribute__((unused)) * arg) { sstrerror(errno, errbuf, sizeof(errbuf))); } - return ((void *)0); + return (void *)0; } /* void *us_server_thread */ static int us_config(const char *key, const char *val) { if (strcasecmp(key, "SocketFile") == 0) { char *new_sock_file = strdup(val); if (new_sock_file == NULL) - return (1); + return 1; sfree(sock_file); sock_file = new_sock_file; } else if (strcasecmp(key, "SocketGroup") == 0) { char *new_sock_group = strdup(val); if (new_sock_group == NULL) - return (1); + return 1; sfree(sock_group); sock_group = new_sock_group; @@ -383,10 +383,10 @@ static int us_config(const char *key, const char *val) { else delete_socket = 0; } else { - return (-1); + return -1; } - return (0); + return 0; } /* int us_config */ static int us_init(void) { @@ -396,7 +396,7 @@ static int us_init(void) { /* Initialize only once. */ if (have_init != 0) - return (0); + return 0; have_init = 1; loop = 1; @@ -407,10 +407,10 @@ static int us_init(void) { char errbuf[1024]; ERROR("unixsock plugin: pthread_create failed: %s", sstrerror(errno, errbuf, sizeof(errbuf))); - return (-1); + return -1; } - return (0); + return 0; } /* int us_init */ static int us_shutdown(void) { @@ -427,7 +427,7 @@ static int us_shutdown(void) { plugin_unregister_init("unixsock"); plugin_unregister_shutdown("unixsock"); - return (0); + return 0; } /* int us_shutdown */ void module_register(void) { @@ -435,5 +435,3 @@ void module_register(void) { plugin_register_init("unixsock", us_init); plugin_register_shutdown("unixsock", us_shutdown); } /* void module_register (void) */ - -/* vim: set sw=4 ts=4 sts=4 tw=78 : */