From patchwork Thu Jan 12 00:54:16 2006 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Darren Salt X-Patchwork-Id: 12154 Received: from anchor-post-34.mail.demon.net ([194.217.242.92]) by www.linuxtv.org with esmtp (Exim 4.50) id 1EwrFC-0002bp-Nt for vdr@linuxtv.org; Thu, 12 Jan 2006 02:27:14 +0100 Received: from youmustbejoking.demon.co.uk ([212.228.127.8] helo=pentagram.youmustbejoking.demon.co.uk) by anchor-post-34.mail.demon.net with esmtp (Exim 4.42) id 1EwrFA-000FGg-Dr for vdr@linuxtv.org; Thu, 12 Jan 2006 01:27:13 +0000 Received: from [192.168.0.2] (helo=riscpc) by pentagram.youmustbejoking.demon.co.uk with esmtp (Exim 4.50) id 1EwrF9-0008Vi-96 for vdr@linuxtv.org; Thu, 12 Jan 2006 01:27:11 +0000 Date: Thu, 12 Jan 2006 00:54:16 +0000 From: Darren Salt To: vdr@linuxtv.org Message-ID: <4DE7CF521D%linux@youmustbejoking.demon.co.uk> User-Agent: Messenger-Pro/3.40 (MsgServe/3.20) (RISC-OS/4.02) POPstar/2.06+cvs X-Editor: Zap 1.47 (17 Oct 2005) [TEST], ZapEmail 0.28.3 (25 Mar 2005) (32) X-SDate: Thu, 4517 Sep 1993 00:54:16 +0000 X-Message-Flag: Outlook Express is broken. Upgrade to mail(1). MIME-Version: 1.0 X-SA-Exim-Connect-IP: 192.168.0.2 X-SA-Exim-Mail-From: linux@youmustbejoking.demon.co.uk X-SA-Exim-Scanned: No (on pentagram.youmustbejoking.demon.co.uk); SAEximRunCond expanded to false Subject: [vdr] [PATCH] vdr-xine 0.7.6: kill a few compiler warnings X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 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, 12 Jan 2006 01:27:14 -0000 Status: O X-Status: X-Keywords: X-UID: 7153 This patch prevents some printf format string warnings when building vdr-xine 0.7.6 with these extra flags: -Wall -Wnonnull -Wformat=2 -Wextra (There are potential problems if the fifo directory's name contains % and mkdir or mknod fails. This patch eliminates them.) diff -urNad vdr-plugin-xine-0.7.6~/xineLib.c vdr-plugin-xine-0.7.6/xineLib.c --- vdr-plugin-xine-0.7.6~/xineLib.c 2006-01-12 01:21:23.599614013 +0000 +++ vdr-plugin-xine-0.7.6/xineLib.c 2006-01-12 01:21:47.774014821 +0000 @@ -1912,8 +1912,8 @@ } else { - ::fprintf(stderr, ("vdr-xine: error: couldn't open '" + noSignalFileName + "'!\n").c_str()); - esyslog(("vdr-xine: error: couldn't open '" + noSignalFileName + "'!\n").c_str()); + ::fprintf(stderr, "vdr-xine: error: couldn't open '%s'!\n", noSignalFileName.c_str()); + esyslog("vdr-xine: error: couldn't open '%s'!\n", noSignalFileName.c_str()); } assert(remote); @@ -1953,69 +1953,32 @@ const mode_t origUmask = ::umask(0); - if (::mkdir(m_fifoDir.c_str(), 0755) < 0) - { - perror(("vdr-xine: error: couldn't create directory '" + m_fifoDir + "'").c_str()); - esyslog(("vdr-xine: error: couldn't create directory '" + m_fifoDir + "'").c_str()); - - ::umask(origUmask); - return false; - } - - if (::mknod(m_fifoNameExtControl.c_str(), 0666 | S_IFIFO, 0) < 0) - { - perror(("vdr-xine: error: couldn't create fifo '" + m_fifoNameExtControl + "'").c_str()); - esyslog(("vdr-xine: error: couldn't create fifo '" + m_fifoNameExtControl + "'").c_str()); - - ::umask(origUmask); - return false; - } - - if (::mknod(m_fifoNameExtResult.c_str(), 0644 | S_IFIFO, 0) < 0) - { - perror(("vdr-xine: error: couldn't create fifo '" + m_fifoNameExtResult + "'").c_str()); - esyslog(("vdr-xine: error: couldn't create fifo '" + m_fifoNameExtResult + "'").c_str()); - - ::umask(origUmask); - return false; - } - - if (::mknod(m_fifoNameControl.c_str(), 0644 | S_IFIFO, 0) < 0) - { - perror(("vdr-xine: error: couldn't create fifo '" + m_fifoNameControl + "'").c_str()); - esyslog(("vdr-xine: error: couldn't create fifo '" + m_fifoNameControl + "'").c_str()); - - ::umask(origUmask); - return false; - } - - if (::mknod(m_fifoNameResult.c_str(), 0666 | S_IFIFO, 0) < 0) - { - perror(("vdr-xine: error: couldn't create fifo '" + m_fifoNameResult + "'").c_str()); - esyslog(("vdr-xine: error: couldn't create fifo '" + m_fifoNameResult + "'").c_str()); - - ::umask(origUmask); - return false; - } +#define MkFifo(String, Mask) \ + do { if (::mknod((String).c_str(), (Mask) | S_IFIFO, 0) < 0) \ + { \ + string msg = "vdr-xine: error: couldn't create fifo '" + (String) + "'"; \ + perror(msg.c_str()); \ + esyslog("%s", msg.c_str()); \ + ::umask(origUmask); \ + return false; \ + } } while (0) - if (::mknod(m_fifoNameRemote.c_str(), 0666 | S_IFIFO, 0) < 0) + if (::mkdir(m_fifoDir.c_str(), 0755) < 0) { - perror(("vdr-xine: error: couldn't create fifo '" + m_fifoNameRemote + "'").c_str()); - esyslog(("vdr-xine: error: couldn't create fifo '" + m_fifoNameRemote + "'").c_str()); - + string msg = "vdr-xine: error: couldn't create directory '" + m_fifoDir + "'"; + perror(msg.c_str()); + esyslog("%s", msg.c_str()); ::umask(origUmask); return false; } - if (::mknod(m_fifoNameStream.c_str(), 0644 | S_IFIFO, 0) < 0) - { - perror(("vdr-xine: error: couldn't create fifo '" + m_fifoNameStream + "'").c_str()); - esyslog(("vdr-xine: error: couldn't create fifo '" + m_fifoNameStream + "'").c_str()); + MkFifo(m_fifoNameExtControl, 0666); + MkFifo(m_fifoNameExtResult, 0644); + MkFifo(m_fifoNameControl, 0644); + MkFifo(m_fifoNameResult, 0666); + MkFifo(m_fifoNameRemote, 0666); + MkFifo(m_fifoNameStream, 0644); - ::umask(origUmask); - return false; - } - ::umask(origUmask); if (!Start())