Adjust patch manually to apply

Undoes effect of e9716e216d970b2c84eff5bde5802a05c202cacb Refactoring: optimize pointer checks
and partly of 3bfa1da201997efb5d728b6d1bcbc0825175b5b2 open: fix whitespace

Related: rhbz2224569
This commit is contained in:
Pavel Cahyna 2023-07-27 13:56:58 +02:00
parent 687d89504a
commit e21c689588
1 changed files with 10 additions and 10 deletions

View File

@ -25,22 +25,22 @@ diff --git a/src/plugins/open/open.c b/src/plugins/open/open.c
index 4fdabeb..8761a6d 100644 index 4fdabeb..8761a6d 100644
--- a/src/plugins/open/open.c --- a/src/plugins/open/open.c
+++ b/src/plugins/open/open.c +++ b/src/plugins/open/open.c
@@ -342,48 +342,61 @@ ipmi_openipmi_send_cmd(struct ipmi_intf *intf, struct ipmi_rq *req) @@ -336,48 +336,61 @@ ipmi_openipmi_send_cmd(struct ipmi_intf *intf, struct ipmi_rq *req)
read_timeout.tv_sec = IPMI_OPENIPMI_READ_TIMEOUT; read_timeout.tv_sec = IPMI_OPENIPMI_READ_TIMEOUT;
read_timeout.tv_usec = 0; read_timeout.tv_usec = 0;
do { do {
- retval = select(intf->fd + 1, &rset, NULL, NULL, &read_timeout); - retval = select(intf->fd+1, &rset, NULL, NULL, &read_timeout);
- } while (retval < 0 && errno == EINTR); - } while (retval < 0 && errno == EINTR);
- if (retval < 0) { - if (retval < 0) {
- lperror(LOG_ERR, "I/O Error"); - lperror(LOG_ERR, "I/O Error");
- if (data) { - if (data != NULL) {
- free(data); - free(data);
- data = NULL; - data = NULL;
- } - }
- return NULL; - return NULL;
- } else if (retval == 0) { - } else if (retval == 0) {
- lprintf(LOG_ERR, "No data available"); - lprintf(LOG_ERR, "No data available");
- if (data) { - if (data != NULL) {
- free(data); - free(data);
- data = NULL; - data = NULL;
- } - }
@ -48,7 +48,7 @@ index 4fdabeb..8761a6d 100644
- } - }
- if (FD_ISSET(intf->fd, &rset) == 0) { - if (FD_ISSET(intf->fd, &rset) == 0) {
- lprintf(LOG_ERR, "No data available"); - lprintf(LOG_ERR, "No data available");
- if (data) { - if (data != NULL) {
- free(data); - free(data);
- data = NULL; - data = NULL;
+ do { + do {
@ -56,14 +56,14 @@ index 4fdabeb..8761a6d 100644
+ } while (retval < 0 && errno == EINTR); + } while (retval < 0 && errno == EINTR);
+ if (retval < 0) { + if (retval < 0) {
+ lperror(LOG_ERR, "I/O Error"); + lperror(LOG_ERR, "I/O Error");
+ if (data) { + if (data != NULL) {
+ free(data); + free(data);
+ data = NULL; + data = NULL;
+ } + }
+ return NULL; + return NULL;
+ } else if (retval == 0) { + } else if (retval == 0) {
+ lprintf(LOG_ERR, "No data available"); + lprintf(LOG_ERR, "No data available");
+ if (data) { + if (data != NULL) {
+ free(data); + free(data);
+ data = NULL; + data = NULL;
+ } + }
@ -72,7 +72,7 @@ index 4fdabeb..8761a6d 100644
- return NULL; - return NULL;
- } - }
- -
- recv.addr = (unsigned char *)&addr; - recv.addr = (unsigned char *) &addr;
- recv.addr_len = sizeof(addr); - recv.addr_len = sizeof(addr);
- recv.msg.data = rsp.data; - recv.msg.data = rsp.data;
- recv.msg.data_len = sizeof(rsp.data); - recv.msg.data_len = sizeof(rsp.data);
@ -83,7 +83,7 @@ index 4fdabeb..8761a6d 100644
- if (errno != EMSGSIZE) { - if (errno != EMSGSIZE) {
+ if (FD_ISSET(intf->fd, &rset) == 0) { + if (FD_ISSET(intf->fd, &rset) == 0) {
+ lprintf(LOG_ERR, "No data available"); + lprintf(LOG_ERR, "No data available");
if (data) { if (data != NULL) {
free(data); free(data);
data = NULL; data = NULL;
} }
@ -100,7 +100,7 @@ index 4fdabeb..8761a6d 100644
+ if (ioctl(intf->fd, IPMICTL_RECEIVE_MSG_TRUNC, &recv) < 0) { + if (ioctl(intf->fd, IPMICTL_RECEIVE_MSG_TRUNC, &recv) < 0) {
+ lperror(LOG_ERR, "Error receiving message"); + lperror(LOG_ERR, "Error receiving message");
+ if (errno != EMSGSIZE) { + if (errno != EMSGSIZE) {
+ if (data) { + if (data != NULL) {
+ free(data); + free(data);
+ data = NULL; + data = NULL;
+ } + }