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.) -- | Darren Salt | nr. Ashington, | d youmustbejoking,demon,co,uk | Debian, | Northumberland | s zap,tartarus,org | RISC OS | Toon Army | @ | Retrocomputing: a PC card in a Risc PC You are a singer who has to take any note above A with your eyebrows. -------------- next part -------------- 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())