Re: [libvirt] [PATCH 2/8] conf: Remove ATTRIBUTE_NONNULL for virDomainQemuMonitorEventNew

2019-11-11 Thread Ján Tomko

On Sun, Nov 03, 2019 at 08:53:34AM -0500, John Ferlan wrote:

Commit 17561eb36 modified the logic to check "if (!event)" for an
attribute that was not supposed to be passed as NULL.  This causes
the static checker/Coverity build to fail. Since the check is made,
alter the header.



Oops, I forgot to push this already acked patch that removed the condition
completely:
https://www.redhat.com/archives/libvir-list/2019-October/msg01505.html

Jano


Also add an error message since returning -1 without some sort of
error message as previously would have happened with the failed
VIR_STRDUP so that the eventual error doesn't get the default
for some reason message.

Signed-off-by: John Ferlan 
---
src/conf/domain_event.c | 6 +-
src/conf/domain_event.h | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 2/8] conf: Remove ATTRIBUTE_NONNULL for virDomainQemuMonitorEventNew

2019-11-03 Thread John Ferlan
Commit 17561eb36 modified the logic to check "if (!event)" for an
attribute that was not supposed to be passed as NULL.  This causes
the static checker/Coverity build to fail. Since the check is made,
alter the header.

Also add an error message since returning -1 without some sort of
error message as previously would have happened with the failed
VIR_STRDUP so that the eventual error doesn't get the default
for some reason message.

Signed-off-by: John Ferlan 
---
 src/conf/domain_event.c | 6 +-
 src/conf/domain_event.h | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index 644f6eb595..900d8f745e 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -1935,8 +1935,12 @@ virDomainQemuMonitorEventNew(int id,
 return NULL;
 
 /* event is mandatory, details are optional */
-if (!event)
+if (!event) {
+virReportError(VIR_ERR_INVALID_ARG,
+   _("unexpected event=NULL name=%s uuid=%s details=%s"),
+   name, uuidstr, NULLSTR(details));
 goto error;
+}
 
 ev->event = g_strdup(event);
 ev->seconds = seconds;
diff --git a/src/conf/domain_event.h b/src/conf/domain_event.h
index d1cfb81d62..0a4bce3d04 100644
--- a/src/conf/domain_event.h
+++ b/src/conf/domain_event.h
@@ -321,4 +321,4 @@ virDomainQemuMonitorEventNew(int id,
  long long seconds,
  unsigned int micros,
  const char *details)
-ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
+ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list