No longer calling 'abort()'

This commit is contained in:
Klaus Schmidinger 2001-04-01 11:18:28 +02:00
parent f3f2d4577d
commit 28130daef7
3 changed files with 14 additions and 11 deletions

View File

@ -445,3 +445,5 @@ Video Disk Recorder Revision History
systems with three or more DVB cards. systems with three or more DVB cards.
- Added the "statdvb2vdr" tool from Hans-Peter Raschke. - Added the "statdvb2vdr" tool from Hans-Peter Raschke.
- Fixed a segfault that sometimes happened when killing VDR. - Fixed a segfault that sometimes happened when killing VDR.
- VDR now returns an exit status of '2' in case of an error at startup, instead
of terminating with 'abort()' (which caused a core dump).

3
runvdr
View File

@ -9,7 +9,8 @@ KILLPROC="/sbin/killproc -TERM"
while (true) do while (true) do
# (cd $DVBDIR; make reload) # (cd $DVBDIR; make reload)
# sleep 3 # sleep 3
if $VDRCMD; then exit; fi $VDRCMD
if test $? != 1; then exit; fi
date date
echo "restarting VDR" echo "restarting VDR"
$KILLPROC $VDRPRG $KILLPROC $VDRPRG

20
vdr.c
View File

@ -22,7 +22,7 @@
* *
* The project's page is at http://www.cadsoft.de/people/kls/vdr * The project's page is at http://www.cadsoft.de/people/kls/vdr
* *
* $Id: vdr.c 1.55 2001/03/31 10:18:25 kls Exp $ * $Id: vdr.c 1.56 2001/04/01 11:16:54 kls Exp $
*/ */
#include <getopt.h> #include <getopt.h>
@ -104,7 +104,7 @@ int main(int argc, char *argv[])
} }
} }
fprintf(stderr, "vdr: invalid DVB device number: %s\n", optarg); fprintf(stderr, "vdr: invalid DVB device number: %s\n", optarg);
abort(); return 2;
break; break;
case 'h': printf("Usage: vdr [OPTION]\n\n" // for easier orientation, this is column 80| case 'h': printf("Usage: vdr [OPTION]\n\n" // for easier orientation, this is column 80|
" -c DIR, --config=DIR read config files from DIR (default is to read them\n" " -c DIR, --config=DIR read config files from DIR (default is to read them\n"
@ -139,13 +139,13 @@ int main(int argc, char *argv[])
} }
} }
fprintf(stderr, "vdr: invalid log level: %s\n", optarg); fprintf(stderr, "vdr: invalid log level: %s\n", optarg);
abort(); return 2;
break; break;
case 'p': if (isnumber(optarg)) case 'p': if (isnumber(optarg))
SVDRPport = atoi(optarg); SVDRPport = atoi(optarg);
else { else {
fprintf(stderr, "vdr: invalid port number: %s\n", optarg); fprintf(stderr, "vdr: invalid port number: %s\n", optarg);
abort(); return 2;
} }
break; break;
case 't': Terminal = optarg; case 't': Terminal = optarg;
@ -162,9 +162,9 @@ int main(int argc, char *argv[])
} }
} }
fprintf(stderr, "vdr: invalid watchdog timeout: %s\n", optarg); fprintf(stderr, "vdr: invalid watchdog timeout: %s\n", optarg);
abort(); return 2;
break; break;
default: abort(); default: return 2;
} }
} }
@ -177,7 +177,7 @@ int main(int argc, char *argv[])
if (!DirectoryOk(VideoDirectory, true)) { if (!DirectoryOk(VideoDirectory, true)) {
fprintf(stderr, "vdr: can't access video directory %s\n", VideoDirectory); fprintf(stderr, "vdr: can't access video directory %s\n", VideoDirectory);
abort(); return 2;
} }
// Daemon mode: // Daemon mode:
@ -188,7 +188,7 @@ int main(int argc, char *argv[])
if (pid < 0) { if (pid < 0) {
fprintf(stderr, "%m\n"); fprintf(stderr, "%m\n");
esyslog(LOG_ERR, "ERROR: %m"); esyslog(LOG_ERR, "ERROR: %m");
abort(); return 2;
} }
if (pid != 0) if (pid != 0)
return 0; // initial program immediately returns return 0; // initial program immediately returns
@ -197,7 +197,7 @@ int main(int argc, char *argv[])
fclose(stderr); fclose(stderr);
#else #else
fprintf(stderr, "vdr: can't run in daemon mode with DEBUG_OSD or REMOTE_KBD on!\n"); fprintf(stderr, "vdr: can't run in daemon mode with DEBUG_OSD or REMOTE_KBD on!\n");
abort(); return 2;
#endif #endif
} }
else if (Terminal) { else if (Terminal) {
@ -227,7 +227,7 @@ int main(int argc, char *argv[])
// DVB interfaces: // DVB interfaces:
if (!cDvbApi::Init()) if (!cDvbApi::Init())
abort(); return 2;
cDvbApi::SetPrimaryDvbApi(Setup.PrimaryDVB); cDvbApi::SetPrimaryDvbApi(Setup.PrimaryDVB);