diff --git a/asterisk.c b/asterisk.c
index 93eab8a435b16e875061b5062c60dcfcd3260dcf..5c1807f864f38ca7eef1223a267d1077d50c6994 100644
--- a/asterisk.c
+++ b/asterisk.c
@@ -2027,13 +2027,17 @@ static void ast_remotecontrol(char * data)
 
 	if (ast_opt_exec && data) {  /* hack to print output then exit if asterisk -rx is used */
 		char tempchar;
+#ifdef __Darwin__
 		struct pollfd fds[0];
 		fds[0].fd = ast_consock;
 		fds[0].events = POLLIN;
 		fds[0].revents = 0;
-		while(poll(fds, 1, 100) > 0) {
+		while (poll(fds, 1, 100) > 0) {
 			ast_el_read_char(el, &tempchar);
 		}
+#else
+		while (!ast_el_read_char(el, &tempchar));
+#endif
 		return;
 	}
 	for (;;) {