#! /bin/sh /usr/share/dpatch/dpatch-run ## 02_radio-0.1.1-fix-DataDir.dpatch by Thomas Günther ## http://toms-cafe.de/vdr/download/radio-0.1.1-fix-DataDir.diff ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Fixes crash if DataDir not exist. @DPATCH@ --- radio-0.1.1/radioaudio.c +++ radio-0.1.1/radioaudio.c @@ -1157,6 +1157,20 @@ char *fname, *fpath; FILE *fd; int ind, lfd = 0; + struct stat sbuf; + if (stat(DataDir, &sbuf) != 0) { + dsyslog("vdr-radio: creating directory %s", DataDir); + if (mkdir(DataDir, ACCESSPERMS)) { + esyslog("ERROR: Failed to create directory %s", DataDir); + return; + } + } + else { + if (!S_ISDIR(sbuf.st_mode)) { + esyslog("ERROR: Failed to create directory %s: file exists but is not a directory", DataDir); + return; + } + } time_t t = time(NULL); ts = localtime(&t);