Remove the ATTRIBUTE_NONNULL(1) from virCommandSetSendBuffer()
prototype since we are checking for '!cmd' and move the initialization
if 'i' after the test for '!cmd'.
Signed-off-by: Stefan Berger <stefanb(a)linux.ibm.com>
Reviewed-by: John Ferlan <jferlan(a)redhat.com>
---
src/util/vircommand.c | 3 ++-
src/util/vircommand.h | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 774038e536..2df71014f8 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -1775,7 +1775,7 @@ virCommandSetSendBuffer(virCommandPtr cmd,
int fd,
unsigned char *buffer, size_t buflen)
{
- size_t i = virCommandGetNumSendBuffers(cmd);
+ size_t i;
if (!cmd || cmd->has_error)
return -1;
@@ -1787,6 +1787,7 @@ virCommandSetSendBuffer(virCommandPtr cmd,
return -1;
}
+ i = virCommandGetNumSendBuffers(cmd);
if (VIR_REALLOC_N(cmd->sendBuffers, i + 1) < 0) {
cmd->has_error = ENOMEM;
return -1;
diff --git a/src/util/vircommand.h b/src/util/vircommand.h
index c2abc7b2c3..74574e3fb1 100644
--- a/src/util/vircommand.h
+++ b/src/util/vircommand.h
@@ -149,7 +149,7 @@ void virCommandSetWorkingDirectory(virCommandPtr cmd,
int virCommandSetSendBuffer(virCommandPtr cmd,
int fd,
unsigned char *buffer, size_t buflen)
- ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
+ ATTRIBUTE_NONNULL(3);
void virCommandSetInputBuffer(virCommandPtr cmd,
const char *inbuf) ATTRIBUTE_NONNULL(2);
--
2.20.1