ibv_asyncwatch defaults to block-buffering when stdout is redirected to a file 
or pipe. This fix makes it more usable in scripted environments.

Signed-off-by: Hakon Bugge <haakon.bu...@sun.com>
---
diff --git a/examples/asyncwatch.c b/examples/asyncwatch.c
index e56b4dc..f9fe6ff 100644
--- a/examples/asyncwatch.c
+++ b/examples/asyncwatch.c
@@ -98,6 +98,9 @@ int main(int argc, char *argv[])
                return 1;
        }
 
+       /* Force line-buffering if stdout is redirected */
+       setlinebuf(stdout);
+
        printf("%s: async event FD %d\n",
               ibv_get_device_name(*dev_list), context->async_fd);

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to