Fix: consumer recv command error path
authorDavid Goulet <dgoulet@efficios.com>
Tue, 11 Sep 2012 19:36:11 +0000 (15:36 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 11 Sep 2012 19:37:00 +0000 (15:37 -0400)
See bug #332.

Backported from the master branch with commit id:
4cbc1a04e8ac3c1dd4f9a4dc44b56ee8430189f0

Signed-off-by: David Goulet <dgoulet@efficios.com>
src/common/consumer.c
src/common/kernel-consumer/kernel-consumer.c
src/common/ust-consumer/ust-consumer.c

index dd8c621f177d56968306fb500ce4546870b5bd2d..024ee17853c03c053dfa0ae4382a7e3763346b1f 100644 (file)
@@ -1221,8 +1221,12 @@ void *lttng_consumer_thread_receive_fds(void *data)
                        DBG("Received STOP command");
                        goto end;
                }
-               if (ret < 0) {
-                       ERR("Communication interrupted on command socket");
+               if (ret <= 0) {
+                       /*
+                        * This could simply be a session daemon quitting. Don't output
+                        * ERR() here.
+                        */
+                       DBG("Communication interrupted on command socket");
                        goto end;
                }
                if (consumer_quit) {
index 3c9687306dc2aa2e904ef35f9954bdcc37e1d436..0dfaa16e7620ec0480a833ef6acce6921e77ec87 100644 (file)
@@ -334,7 +334,12 @@ end:
                ret = write(ctx->consumer_poll_pipe[1], "", 1);
        } while (ret == -1UL && errno == EINTR);
 end_nosignal:
-       return 0;
+
+       /*
+        * Return 1 to indicate success since the 0 value can be a socket shutdown
+        * during the recv() or send() call.
+        */
+       return 1;
 }
 
 /*
index 47c0d460ffb60cc612d9806325602c6eac459023..935f6f31139e4e095219e1bb2e9c59d420718572 100644 (file)
@@ -282,7 +282,12 @@ end:
                ret = write(ctx->consumer_poll_pipe[1], "", 1);
        } while (ret == -1UL && errno == EINTR);
 end_nosignal:
-       return 0;
+
+       /*
+        * Return 1 to indicate success since the 0 value can be a socket shutdown
+        * during the recv() or send() call.
+        */
+       return 1;
 }
 
 int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan)
This page took 0.028316 seconds and 4 git commands to generate.