diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-05 21:04:41 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-05 21:04:41 +0000 |
commit | a51106ed6932423c25c7d464ef5c2d609bd62924 (patch) | |
tree | b40cd0bcb45e9d56ee030c434e79351cfe57e1b3 /tools/storage_mon.c | |
parent | Adding upstream version 1:4.13.0. (diff) | |
download | resource-agents-upstream/1%4.14.0.tar.xz resource-agents-upstream/1%4.14.0.zip |
Adding upstream version 1:4.14.0.upstream/1%4.14.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/storage_mon.c')
-rw-r--r-- | tools/storage_mon.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/storage_mon.c b/tools/storage_mon.c index 1aae29e..a9227ef 100644 --- a/tools/storage_mon.c +++ b/tools/storage_mon.c @@ -382,9 +382,11 @@ static int write_pid_file(const char *pidfile) syslog(LOG_ERR, "Failed to write '%s' to %s: %s", pid, pidfile, strerror(errno)); goto done; } - close(fd); rc = 0; done: + if (fd != -1) { + close(fd); + } if (pid != NULL) { free(pid); } @@ -653,6 +655,7 @@ storage_mon_client(void) int32_t rc; + memset(&response, 0, sizeof(response)); snprintf(ipcs_name, SMON_MAX_IPCSNAME, "storage_mon_%s", attrname); conn = qb_ipcc_connect(ipcs_name, 0); if (conn == NULL) { @@ -663,6 +666,7 @@ storage_mon_client(void) snprintf(request.message, SMON_MAX_MSGSIZE, "%s", SMON_GET_RESULT_COMMAND); request.hdr.id = 0; request.hdr.size = sizeof(struct storage_mon_check_value_req); + response.hdr.id = 0; rc = qb_ipcc_send(conn, &request, request.hdr.size); if (rc < 0) { syslog(LOG_ERR, "qb_ipcc_send error : %d\n", rc); @@ -683,7 +687,11 @@ storage_mon_client(void) /* greater than 0 : monitoring error. */ /* -1 : communication system error. */ /* -2 : Not all checks completed for first device in daemon mode. */ - rc = atoi(response.message); + if (strnlen(response.message, 1)) { + rc = atoi(response.message); + } else { + rc = -1; + } syslog(LOG_DEBUG, "daemon response[%d]: %s \n", response.hdr.id, response.message); |