$NetBSD: patch-ab,v 1.2 2004/05/11 12:18:37 wiz Exp $

--- ../guicontrol.c.orig	1998-02-20 20:44:16.000000000 +0100
+++ ../guicontrol.c
@@ -312,6 +312,14 @@ void gui_control(void)
       if (quit_flag)
 	{
 /* 	  fprintf(stderr, "quit_flag is true\n"); */
+
+	  if((flags = fcntl(STDOUT_FILENO, F_GETFL, 0)) < 0)
+	    perror("fcntl");
+	  flags &= ~O_NONBLOCK;
+  
+	  if(fcntl(STDOUT_FILENO, F_SETFL, flags) < 0)
+	    perror("fcntl");
+
 	  exit(0);
 	}
       while(GUI_FD_TO_PLAY != -1)
@@ -334,7 +342,7 @@ void gui_control(void)
 	 
 	 if((flags = fcntl(STDIN_FILENO, F_GETFL, 0)) < 0)
 	   perror("fcntl");
-	 flags ^= O_NONBLOCK;
+	 flags &= ~O_NONBLOCK;
 	 
 	 if(fcntl(STDIN_FILENO, F_SETFL, flags) < 0)
 	   perror("fcntl");
@@ -395,7 +403,7 @@ int decodeMPEG_2(int inFilefd)
                 /* Set stdin to blocking */
                 if((flags = fcntl(STDIN_FILENO, F_GETFL, 0)) < 0)
                         perror("fcntl");
-                flags ^= O_NONBLOCK;
+                flags &= ~O_NONBLOCK;
                 if(fcntl(STDIN_FILENO, F_SETFL, flags) < 0)
                         perror("fcntl");
         }
