diff mbox

coverity: Model g_poll()

Message ID 1448975034-1314-1-git-send-email-armbru@redhat.com
State New
Headers show

Commit Message

Markus Armbruster Dec. 1, 2015, 1:03 p.m. UTC
Coverity now reports two more CHECKED_RETURN:

* qemu-char.c:1248: Should be fixed by Paolo's "qemu-char: retry
  g_poll on EINTR".

* migration/qemu-file-unix.c:75: if g_poll() fails, we retry sending
  before the file descriptor is ready.  Errors other than EINTR are
  mostly theoretical, though.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 scripts/coverity-model.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Paolo Bonzini Dec. 1, 2015, 1:13 p.m. UTC | #1
On 01/12/2015 14:03, Markus Armbruster wrote:
> Coverity now reports two more CHECKED_RETURN:
> 
> * qemu-char.c:1248: Should be fixed by Paolo's "qemu-char: retry
>   g_poll on EINTR".
> 
> * migration/qemu-file-unix.c:75: if g_poll() fails, we retry sending
>   before the file descriptor is ready.  Errors other than EINTR are
>   mostly theoretical, though.

EINTR is harmless too here, you'll just get another EAGAIN.  I'll mark
it as Intentional / Fix Required in the coverity dashboard.

Paolo

> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
Markus Armbruster Dec. 1, 2015, 1:34 p.m. UTC | #2
Paolo Bonzini <pbonzini@redhat.com> writes:

> On 01/12/2015 14:03, Markus Armbruster wrote:
>> Coverity now reports two more CHECKED_RETURN:
>> 
>> * qemu-char.c:1248: Should be fixed by Paolo's "qemu-char: retry
>>   g_poll on EINTR".
>> 
>> * migration/qemu-file-unix.c:75: if g_poll() fails, we retry sending
>>   before the file descriptor is ready.  Errors other than EINTR are
>>   mostly theoretical, though.
>
> EINTR is harmless too here, you'll just get another EAGAIN.  I'll mark
> it as Intentional / Fix Required in the coverity dashboard.

I posted a cleanup patch anyway.  Migration maintainers can decide
whether they want it or not.
diff mbox

Patch

diff --git a/scripts/coverity-model.c b/scripts/coverity-model.c
index e1d5f45..ee5bf9d 100644
--- a/scripts/coverity-model.c
+++ b/scripts/coverity-model.c
@@ -342,6 +342,15 @@  char *g_strconcat(const char *s, ...)
 
 /* Other glib functions */
 
+typedef struct pollfd GPollFD;
+
+int poll();
+
+int g_poll (GPollFD *fds, unsigned nfds, int timeout)
+{
+    return poll(fds, nfds, timeout);
+}
+
 typedef struct _GIOChannel GIOChannel;
 GIOChannel *g_io_channel_unix_new(int fd)
 {