1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-27 00:57:50 +00:00

Make xbsndsrv exit on pipe read errors.

This commit is contained in:
Stefan Eßer 2004-12-30 21:51:22 +00:00
parent 55fb9b78fa
commit e045a7d071
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=125564

View File

@ -1,6 +1,6 @@
--- xbsndsrv.c.orig Sat Sep 7 17:50:18 2002
+++ xbsndsrv.c Sat Sep 7 17:50:25 2002
@@ -110,7 +110,7 @@
--- xbsndsrv.c.orig Wed Jul 7 12:53:13 2004
+++ xbsndsrv.c Thu Dec 30 21:45:25 2004
@@ -43,7 +43,7 @@
#include <sys/ioctl.h>
#include <sys/time.h>
#ifdef __FreeBSD__
@ -9,3 +9,28 @@
#else
#include <linux/soundcard.h>
#endif
@@ -723,16 +723,23 @@
int n;
struct timeval tv;
fd_set rs;
+ fd_set es;
while(1)
{
tv.tv_sec = tv.tv_usec = 0;
FD_ZERO(&rs);
FD_SET(0, &rs);
+ FD_ZERO(&es);
+ FD_SET(0, &es);
- if (select(1, &rs, NULL, NULL, &tv) > 0 && FD_ISSET(0, &rs))
+ if (select(1, &rs, NULL, &es, &tv) > 0 && FD_ISSET(0, &rs))
{
n = read(0, command_buff, 8);
+ if ((n == 0) && FD_ISSET(0, &es)) {
+ fprintf(stderr, "Parent was killed, bailing out ...\n");
+ exit(0);
+ }
cmd = command_buff;
/* there are commands in the pipe */
while (n > 0)