1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

VDR now stops with result value 2 if one of the configuration files can't be read correctly at program startup

This commit is contained in:
Klaus Schmidinger 2003-08-16 09:18:52 +02:00
parent fc19cf3527
commit 57a95c6790
6 changed files with 31 additions and 21 deletions

View File

@ -317,6 +317,8 @@ Rainer Zocholl <vdrcontrib@zocki.toppoint.de>
for reporting a bug in skipping the next hit of a repeating timer
for reporting a problem with staying off the end of an ongoing recording while
replaying in time shift mode
for suggesting that VDR should stop if one of the configuration files can't be
read correctly at program startup
Oleg Assovski <assen@bitcom.msk.ru>
for adding EPG scanning for another 4 days

View File

@ -2300,3 +2300,5 @@ Video Disk Recorder Revision History
to Reinhard Nissl for reporting this one).
- Fixed staying off the end of an ongoing recording while replaying in time shift
mode (thanks to Rainer Zocholl for reporting this one).
- VDR now stops with exit status 2 if one of the configuration files can't be
read correctly at program startup (suggested by Rainer Zocholl).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: channels.c 1.12 2003/04/26 09:57:48 kls Exp $
* $Id: channels.c 1.13 2003/08/16 09:12:26 kls Exp $
*/
#include "channels.h"
@ -390,9 +390,9 @@ bool cChannel::Save(FILE *f)
cChannels Channels;
bool cChannels::Load(const char *FileName, bool AllowComments)
bool cChannels::Load(const char *FileName, bool AllowComments, bool MustExist)
{
if (cConfig<cChannel>::Load(FileName, AllowComments)) {
if (cConfig<cChannel>::Load(FileName, AllowComments, MustExist)) {
ReNumber();
return true;
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: channels.h 1.7 2003/04/26 09:15:40 kls Exp $
* $Id: channels.h 1.8 2003/08/16 09:12:15 kls Exp $
*/
#ifndef __CHANNELS_H
@ -130,7 +130,7 @@ protected:
int maxNumber;
public:
cChannels(void) { maxNumber = 0; }
virtual bool Load(const char *FileName, bool AllowComments = false);
virtual bool Load(const char *FileName, bool AllowComments = false, bool MustExist = false);
int GetNextGroup(int Idx); // Get next channel group
int GetPrevGroup(int Idx); // Get previous channel group
int GetNextNormal(int Idx); // Get next normal channel (not group)

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: config.h 1.166 2003/08/06 14:45:10 kls Exp $
* $Id: config.h 1.167 2003/08/16 09:08:33 kls Exp $
*/
#ifndef __CONFIG_H
@ -87,7 +87,7 @@ public:
cConfig(void) { fileName = NULL; }
virtual ~cConfig() { free(fileName); }
const char *FileName(void) { return fileName; }
bool Load(const char *FileName = NULL, bool AllowComments = false)
bool Load(const char *FileName = NULL, bool AllowComments = false, bool MustExist = false)
{
Clear();
if (FileName) {
@ -95,7 +95,7 @@ public:
fileName = strdup(FileName);
allowComments = AllowComments;
}
bool result = false;
bool result = !MustExist;
if (fileName && access(fileName, F_OK) == 0) {
isyslog("loading %s", fileName);
FILE *f = fopen(fileName, "r");
@ -125,9 +125,13 @@ public:
}
fclose(f);
}
else
else {
LOG_ERROR_STR(fileName);
result = false;
}
}
if (!result)
fprintf(stderr, "vdr: error while reading '%s'\n", fileName);
return result;
}
bool Save(void)

26
vdr.c
View File

@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/vdr
*
* $Id: vdr.c 1.162 2003/08/02 14:01:32 kls Exp $
* $Id: vdr.c 1.163 2003/08/16 09:15:28 kls Exp $
*/
#include <getopt.h>
@ -341,17 +341,19 @@ int main(int argc, char *argv[])
cPlugin::SetConfigDirectory(ConfigDirectory);
Setup.Load(AddDirectory(ConfigDirectory, "setup.conf"));
Sources.Load(AddDirectory(ConfigDirectory, "sources.conf"), true);
Diseqcs.Load(AddDirectory(ConfigDirectory, "diseqc.conf"), true);
Channels.Load(AddDirectory(ConfigDirectory, "channels.conf"));
Timers.Load(AddDirectory(ConfigDirectory, "timers.conf"));
Commands.Load(AddDirectory(ConfigDirectory, "commands.conf"), true);
RecordingCommands.Load(AddDirectory(ConfigDirectory, "reccmds.conf"), true);
SVDRPhosts.Load(AddDirectory(ConfigDirectory, "svdrphosts.conf"), true);
CaDefinitions.Load(AddDirectory(ConfigDirectory, "ca.conf"), true);
Keys.Load(AddDirectory(ConfigDirectory, "remote.conf"));
KeyMacros.Load(AddDirectory(ConfigDirectory, "keymacros.conf"), true);
if (!(Setup.Load(AddDirectory(ConfigDirectory, "setup.conf")) &&
Sources.Load(AddDirectory(ConfigDirectory, "sources.conf"), true, true) &&
Diseqcs.Load(AddDirectory(ConfigDirectory, "diseqc.conf"), true, true) &&
Channels.Load(AddDirectory(ConfigDirectory, "channels.conf"), false, true) &&
Timers.Load(AddDirectory(ConfigDirectory, "timers.conf")) &&
Commands.Load(AddDirectory(ConfigDirectory, "commands.conf"), true) &&
RecordingCommands.Load(AddDirectory(ConfigDirectory, "reccmds.conf"), true) &&
SVDRPhosts.Load(AddDirectory(ConfigDirectory, "svdrphosts.conf"), true) &&
CaDefinitions.Load(AddDirectory(ConfigDirectory, "ca.conf"), true) &&
Keys.Load(AddDirectory(ConfigDirectory, "remote.conf")) &&
KeyMacros.Load(AddDirectory(ConfigDirectory, "keymacros.conf"), true)
))
return 2;
// DVB interfaces: