mirror of
				https://github.com/vdr-projects/vdr.git
				synced 2025-03-01 10:50:46 +00:00 
			
		
		
		
	Fixed 'zombie' processes when closing a pipe
This commit is contained in:
		| @@ -146,6 +146,7 @@ Artur Skawina <skawina@geocities.com> | |||||||
| Werner Fink <werner@suse.de> | Werner Fink <werner@suse.de> | ||||||
|  for making I/O more robust by handling EINTR |  for making I/O more robust by handling EINTR | ||||||
|  for fixing closing all unused file descriptors when opening a pipe |  for fixing closing all unused file descriptors when opening a pipe | ||||||
|  |  for helping to debug leftover 'zombie' processes when closing a pipe | ||||||
|  |  | ||||||
| Rolf Hakenes <hakenes@hippomi.de> | Rolf Hakenes <hakenes@hippomi.de> | ||||||
|  for providing 'libdtv' and adapting the EIT mechanisms to it |  for providing 'libdtv' and adapting the EIT mechanisms to it | ||||||
|   | |||||||
							
								
								
									
										3
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								HISTORY
									
									
									
									
									
								
							| @@ -1083,3 +1083,6 @@ Video Disk Recorder Revision History | |||||||
| - Fixed resetting 'mute' state when setting the volume to a non-zero value. | - Fixed resetting 'mute' state when setting the volume to a non-zero value. | ||||||
| - Added log messages when deleting recordings in case the disk runs full while | - Added log messages when deleting recordings in case the disk runs full while | ||||||
|   recording. |   recording. | ||||||
|  | - Fixed closing a pipe (used for replaying Dolby Digital audio), which | ||||||
|  |   sometimes left 'zombie' processes behind (thanks to Werner Fink for helping | ||||||
|  |   to debug this one). | ||||||
|   | |||||||
							
								
								
									
										19
									
								
								thread.c
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								thread.c
									
									
									
									
									
								
							| @@ -4,7 +4,7 @@ | |||||||
|  * See the main source file 'vdr.c' for copyright information and |  * See the main source file 'vdr.c' for copyright information and | ||||||
|  * how to reach the author. |  * how to reach the author. | ||||||
|  * |  * | ||||||
|  * $Id: thread.c 1.18 2002/02/23 13:49:06 kls Exp $ |  * $Id: thread.c 1.19 2002/03/09 11:51:56 kls Exp $ | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "thread.h" | #include "thread.h" | ||||||
| @@ -327,14 +327,21 @@ int cPipe::Close(void) | |||||||
|      f = NULL; |      f = NULL; | ||||||
|      } |      } | ||||||
|  |  | ||||||
|   if (pid >= 0) { |   if (pid > 0) { | ||||||
|      int status = 0; |      int status = 0; | ||||||
|      struct rusage ru; |  | ||||||
|      int i = 5; |      int i = 5; | ||||||
|      while (ret == -1 && i > 0) { |      while (i > 0) { | ||||||
|            usleep(1000); |            ret = waitpid(pid, &status, WNOHANG); | ||||||
|            ret = wait4(pid, &status, WNOHANG, &ru); |            if (ret < 0) { | ||||||
|  |               if (errno != EINTR && errno != ECHILD) { | ||||||
|  |                  LOG_ERROR; | ||||||
|  |                  break; | ||||||
|  |                  } | ||||||
|  |               } | ||||||
|  |            else if (ret == pid) | ||||||
|  |               break; | ||||||
|            i--; |            i--; | ||||||
|  |            usleep(100000); | ||||||
|            } |            } | ||||||
|     |     | ||||||
|      if (!i) { |      if (!i) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user