diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2002-02-02 13:44:24 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2002-02-02 13:44:24 +0100 |
commit | ddec0a101bfb97caa23ca731b8041547717a5eb3 (patch) | |
tree | 10ae250d9740fae442ca54466ca69e175f223ee9 | |
parent | 2a31a4eca81b75bfab9a9fbbe2aa8f9eeec38f9f (diff) | |
download | vdr-ddec0a101bfb97caa23ca731b8041547717a5eb3.tar.gz vdr-ddec0a101bfb97caa23ca731b8041547717a5eb3.tar.bz2 |
Changed the [dei]syslog macros to use var args; fixed error handling in establishing an SVDRP connection
-rw-r--r-- | CONTRIBUTORS | 3 | ||||
-rw-r--r-- | HISTORY | 4 | ||||
-rw-r--r-- | config.c | 5 | ||||
-rw-r--r-- | dvbapi.c | 17 | ||||
-rw-r--r-- | remux.c | 5 | ||||
-rw-r--r-- | svdrp.c | 4 | ||||
-rw-r--r-- | tools.c | 5 | ||||
-rw-r--r-- | tools.h | 8 |
8 files changed, 25 insertions, 26 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index d340d0fa..1703a3c5 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -182,3 +182,6 @@ Sergei Haller <Sergei.Haller@math.uni-giessen.de> Andreas Gebel <andreas@xcapenet.de> for his help in keeping 'channels.conf' up to date + +Davide Achilli <davide@objsystem.it> + for pointing out a bug in error handling while establishing an SVDRP connection @@ -946,3 +946,7 @@ Video Disk Recorder Revision History data is cleaned up and when VDR is terminated). Maybe somebody in charge of the EPG data at the listed channels will read this and take the necessary actions to fix these things... +- Changed the [dei]syslog macros in tools.h to use a variable number of args, + thus making it safe to use them in nested 'if/else' statements. +- Fixed error handling in establishing an SVDRP connection (thanks to Davide + Achilli) for pointing this out). @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.c 1.78 2002/02/01 15:35:23 kls Exp $ + * $Id: config.c 1.79 2002/02/02 12:45:30 kls Exp $ */ #include "config.h" @@ -296,9 +296,8 @@ bool cChannel::Switch(cDvbApi *DvbApi, bool Log) if (!DvbApi) DvbApi = cDvbApi::PrimaryDvbApi; if (!DvbApi->Recording() && !groupSep) { - if (Log) { + if (Log) isyslog(LOG_INFO, "switching to channel %d", number); - } for (int i = 3; i--;) { switch (DvbApi->SetChannel(number, frequency, polarization, diseqc, srate, vpid, apid1, apid2, dpid1, dpid2, tpid, ca, pnr)) { case scrOk: return true; @@ -7,7 +7,7 @@ * DVD support initially written by Andreas Schultz <aschultz@warp10.net> * based on dvdplayer-0.5 by Matjaz Thaler <matjaz.thaler@guest.arnes.si> * - * $Id: dvbapi.c 1.146 2002/01/26 15:39:48 kls Exp $ + * $Id: dvbapi.c 1.147 2002/02/02 13:04:00 kls Exp $ */ //#define DVDDEBUG 1 @@ -548,9 +548,8 @@ void cRecordBuffer::Input(void) } else if (r < 0) { if (FATALERRNO) { - if (errno == EBUFFEROVERFLOW) { // this error code is not defined in the library + if (errno == EBUFFEROVERFLOW) // this error code is not defined in the library esyslog(LOG_ERR, "ERROR (%s,%d): DVB driver buffer overflow", __FILE__, __LINE__); - } else { LOG_ERROR; break; @@ -1064,9 +1063,8 @@ cReplayBuffer::cReplayBuffer(cDvbApi *DvbApi, int VideoDev, int AudioDev, const return; // Create the index file: index = new cIndexFile(FileName, false); - if (!index) { + if (!index) esyslog(LOG_ERR, "ERROR: can't allocate index"); - } else if (!index->Ok()) { delete index; index = NULL; @@ -2251,9 +2249,8 @@ void cTransferBuffer::Input(void) } else if (r < 0) { if (FATALERRNO) { - if (errno == EBUFFEROVERFLOW) { // this error code is not defined in the library + if (errno == EBUFFEROVERFLOW) // this error code is not defined in the library esyslog(LOG_ERR, "ERROR (%s,%d): DVB driver buffer overflow", __FILE__, __LINE__); - } else { LOG_ERROR; break; @@ -2719,12 +2716,10 @@ bool cDvbApi::Init(void) } } PrimaryDvbApi = dvbApi[0]; - if (NumDvbApis > 0) { + if (NumDvbApis > 0) isyslog(LOG_INFO, "found %d video device%s", NumDvbApis, NumDvbApis > 1 ? "s" : ""); - } // need braces because of isyslog-macro - else { + else esyslog(LOG_ERR, "ERROR: no video device found, giving up!"); - } return NumDvbApis > 0; } @@ -8,7 +8,7 @@ * the Linux DVB driver's 'tuxplayer' example and were rewritten to suit * VDR's needs. * - * $Id: remux.c 1.6 2001/08/19 11:52:05 kls Exp $ + * $Id: remux.c 1.7 2002/02/02 12:54:30 kls Exp $ */ /* The calling interface of the 'cRemux::Process()' function is defined @@ -583,9 +583,8 @@ XXX*/ if (l < 0) return NULL; // no useful data found, wait for more if (pt != NO_PICTURE) { - if (pt < I_FRAME || B_FRAME < pt) { + if (pt < I_FRAME || B_FRAME < pt) esyslog(LOG_ERR, "ERROR: unknown picture type '%d'", pt); - } else if (!synced) { if (pt == I_FRAME) { resultDelivered = i; // will drop everything before this position @@ -10,7 +10,7 @@ * and interact with the Video Disk Recorder - or write a full featured * graphical interface that sits on top of an SVDRP connection. * - * $Id: svdrp.c 1.28 2002/01/13 16:07:42 kls Exp $ + * $Id: svdrp.c 1.29 2002/02/02 13:33:57 kls Exp $ */ #include "svdrp.h" @@ -103,7 +103,7 @@ int cSocket::Accept(void) int newsock = accept(sock, (struct sockaddr *)&clientname, &size); if (newsock > 0) isyslog(LOG_INFO, "connect from %s, port %hd", inet_ntoa(clientname.sin_addr), ntohs(clientname.sin_port)); - else if (errno != EINTR) + else if (errno != EINTR && errno != EAGAIN) LOG_ERROR; return newsock; } @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.c 1.53 2002/01/27 12:36:23 kls Exp $ + * $Id: tools.c 1.54 2002/02/02 13:03:40 kls Exp $ */ #include "tools.h" @@ -404,9 +404,8 @@ char *ReadLink(const char *FileName) if (n < 0) { if (errno == ENOENT || errno == EINVAL) // file doesn't exist or is not a symlink TargetName = FileName; - else { // some other error occurred + else // some other error occurred LOG_ERROR_STR(FileName); - } } else if (n < int(sizeof(RealName))) { // got it! RealName[n] = 0; @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.h 1.39 2002/01/26 15:38:10 kls Exp $ + * $Id: tools.h 1.40 2002/02/02 13:16:47 kls Exp $ */ #ifndef __TOOLS_H @@ -20,9 +20,9 @@ extern int SysLogLevel; -#define esyslog if (SysLogLevel > 0) syslog -#define isyslog if (SysLogLevel > 1) syslog -#define dsyslog if (SysLogLevel > 2) syslog +#define esyslog(a...) void( (SysLogLevel > 0) ? syslog(a) : void() ) +#define isyslog(a...) void( (SysLogLevel > 1) ? syslog(a) : void() ) +#define dsyslog(a...) void( (SysLogLevel > 2) ? syslog(a) : void() ) #define LOG_ERROR esyslog(LOG_ERR, "ERROR (%s,%d): %m", __FILE__, __LINE__) #define LOG_ERROR_STR(s) esyslog(LOG_ERR, "ERROR: %s: %m", s) |