On 7/26/19 9:42 AM, Stefan Berger wrote:
Remove the ATTRIBUTE_NONNULL(1) from virCommandSetSendBuffer()
prototype since we are checking for '!cmd'.
Signed-off-by: Stefan Berger <stefanb(a)linux.ibm.com>
---
src/util/vircommand.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Coverity will complain that virCommandSetSendBuffer has:
size_t i = virCommandGetNumSendBuffers(cmd);
if (!cmd || cmd->has_error)
return -1;
Since @cmd is dereffed in virCommandGetNumSendBuffers
Just move the initialization to after the return -1; and things will be
good.
John
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);