From patchwork Thu Jun 7 20:47:19 2007 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anssi Hannula X-Patchwork-Id: 12469 Received: from pne-smtpout3-sn2.hy.skanova.net ([81.228.8.111]) by www.linuxtv.org with esmtp (Exim 4.63) (envelope-from ) id 1HwOtY-0008Tp-AJ for vdr@linuxtv.org; Thu, 07 Jun 2007 22:47:48 +0200 Received: from mail.onse.fi (84.250.84.250) by pne-smtpout3-sn2.hy.skanova.net (7.2.075) id 4667D3200000789E for vdr@linuxtv.org; Thu, 7 Jun 2007 22:47:17 +0200 Received: from gamma.onse.fi (gamma [10.0.0.7]) by mail.onse.fi (Postfix) with ESMTP id 5E97B30FC05A for ; Thu, 7 Jun 2007 23:47:14 +0300 (EEST) Message-ID: <46686ED7.8070708@gmail.com> Date: Thu, 07 Jun 2007 23:47:19 +0300 From: Anssi Hannula User-Agent: Thunderbird 2.0.0.0 (X11/20070522) MIME-Version: 1.0 To: VDR Mailing List References: <46675ABE.7040304@gmail.com> In-Reply-To: Subject: Re: [vdr] VDR timer + mplayer = VDR crash. Please fix! X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.9 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jun 2007 20:47:48 -0000 Status: O X-Status: X-Keywords: X-UID: 13108 VDR User wrote: > On 6/6/07, Anssi Hannula wrote: >> VDR User wrote: >>> If a timer is triggered while the mplayer plugin is in use, VDR >>> crashes. This has happened to me about a zillion times now and I'm >>> hoping somebody will fix this! You can use the mplayer plugin after a >>> timer is started no problem. Correct me if I'm wrong but mplayer >>> should never have to take control of the tuner in the first place >>> since it's not required to play a media file. >>> >>> Free booze to anyone who can fix this incredibly annoying problem once >>> and for all!! >> This could be related to the fact that when mplayer-plugin forks mplayer >> from vdr, the /dev/dvb/adapter* file descriptors are copied as well and >> are not closed. > > Thanks for such a quick reply Anssi! Is that an easy thing to fix? Attached is a patch for mplayer plugin which closes file descriptors (except 0, 1, 2) when forking mplayer script. diff -Nurp -x '*~' mp3-0.9.15/player-mplayer.c mp3-0.9.15-c/player-mplayer.c --- mp3-0.9.15/player-mplayer.c 2006-09-19 21:17:50.000000000 +0300 +++ mp3-0.9.15-c/player-mplayer.c 2007-06-07 23:34:17.000000000 +0300 @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -395,6 +396,11 @@ bool cMPlayerPlayer::Fork(void) close(outpipe[1]); } + rlimit lim; + if(getrlimit(RLIMIT_NOFILE, &lim) == 0) + for(int i = lim.rlim_max - 1; i > 2; i--) + close(i); + char cmd[64+PATH_MAX*2], aid[20]; char *fname=Quote(file->FullPath()); if(MPlayerAid>=0) snprintf(aid,sizeof(aid)," AID %d",MPlayerAid);