Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP2:Update
collectd
dpdk_telemetry-plugin-refactor-clean-up-of-sock...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File dpdk_telemetry-plugin-refactor-clean-up-of-socket-close.patch of Package collectd
From: Reshma Pattan <reshma.pattan@intel.com> Subject: dpdk_telemetry plugin: refactor clean up of socket close References: jsc#SLE-23472 Patch-Mainline: collectd-5.11.0 Git-commit: 097e87b76b22d9a7d3ab37176a399e535d8dab31 Git-repo: git://github.com/collectd/collectd.git.git Instead of closing each socket during failures, just call clean up function to be more consistent across the file. Signed-off-by: Reshma Pattan <reshma.pattan@intel.com> Signed-off-by: <trenn@suse.com> diff --git a/src/dpdk_telemetry.c b/src/dpdk_telemetry.c index f356ed32..b46e8574 100755 --- a/src/dpdk_telemetry.c +++ b/src/dpdk_telemetry.c @@ -241,6 +241,9 @@ static int dpdk_telemetry_cleanup(void) { close(client.s_send); close(client.s_recv); close(client.fd); + client.s_send = -1; + client.s_recv = -1; + client.fd = -1; return 0; } @@ -265,7 +268,7 @@ static int dpdk_telemetry_socket_init(void) { if (client.s_recv < 0) { ERROR(PLUGIN_NAME ": Failed to open message socket errno(%d), error(%s)", errno, strerror(errno)); - close(client.s_send); + dpdk_telemetry_cleanup(); return -1; } client.addr.sun_family = AF_UNIX; @@ -275,8 +278,7 @@ static int dpdk_telemetry_socket_init(void) { sizeof(client.addr)) < 0) { ERROR(PLUGIN_NAME ": Failed to connect errno(%d), error(%s)", errno, strerror(errno)); - close(client.s_send); - close(client.s_recv); + dpdk_telemetry_cleanup(); return -1; } client.addrs.sun_family = AF_UNIX; @@ -287,15 +289,13 @@ static int dpdk_telemetry_socket_init(void) { sizeof(client.addrs)) < 0) { ERROR(PLUGIN_NAME ": Failed to bind errno(%d), error(%s)", errno, strerror(errno)); - close(client.s_send); - close(client.s_recv); + dpdk_telemetry_cleanup(); return -1; } if (listen(client.s_recv, 1) < 0) { ERROR(PLUGIN_NAME ": Listen failed errno(%d), error(%s)", errno, strerror(errno)); - close(client.s_send); - close(client.s_recv); + dpdk_telemetry_cleanup(); return -1; } snprintf(message, sizeof(message), @@ -305,16 +305,14 @@ static int dpdk_telemetry_socket_init(void) { if (send(client.s_send, message, strlen(message), 0) < 0) { ERROR(PLUGIN_NAME ": Could not send register message errno(%d), error(%s)", errno, strerror(errno)); - close(client.s_send); - close(client.s_recv); + dpdk_telemetry_cleanup(); return -1; } client.fd = accept(client.s_recv, NULL, NULL); if (client.fd < 0) { ERROR(PLUGIN_NAME ": Failed to accept errno(%d), error(%s)", errno, strerror(errno)); - close(client.s_send); - close(client.s_recv); + dpdk_telemetry_cleanup(); return -1; } return 0;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor