Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] VDR patches: alternative no-NPTL and plugin handling
Three patches to try:
1. Alternative no-NPTL patch.
Instead of terminating, this patch will try to restart vdr with
LD_ASSUME_KERNEL=2.4.21 in the environment.
2. Allow commas as separators for plugin parameters.
I have a rewritten runvdr here for which this patch is *very* useful (given
/etc/default/vdr and /etc/init.d/vdr in the Debian package of 1.2.6, which my
package has inherited), mainly due to shell quoting and this version being a
small C program. With this, you can say -Pxine,-r instead of "-Pxine -r".
3. Don't exit if a plugin is missing.
Useful just in case some plugin hasn't yet been recompiled for your shiny new
freshly-upgraded vdr...
--
| Darren Salt | nr. Ashington, | d youmustbejoking,demon,co,uk
| Debian, | Northumberland | s zap,tartarus,org
| RISC OS | Toon Army | @
| You too can roll your own kernel...
If you prepare for something that can go wrong, something else will instead.
diff -urNad vdr-1.3.11/vdr.c vdr-1.3.11/vdr.c
--- vdr-1.3.11/vdr.c 2004-06-19 15:42:31.000000000 +0100
+++ vdr-1.3.11/vdr.c 2004-06-19 15:45:14.000000000 +0100
@@ -25,12 +25,12 @@
* $Id: vdr.c 1.184 2004/06/13 13:52:09 kls Exp $
*/
+#include <unistd.h>
#include <getopt.h>
#include <locale.h>
#include <signal.h>
#include <stdlib.h>
#include <termios.h>
-#include <unistd.h>
#include <sys/types.h>
#include "audio.h"
#include "channels.h"
@@ -85,16 +85,22 @@
int main(int argc, char *argv[])
{
-#ifdef _CS_GNU_LIBPTHREAD_VERSION
- // Check for NPTL and exit if present - VDR apparently doesn't run well with NPTL:
- char LibPthreadVersion[128];
- if (confstr(_CS_GNU_LIBPTHREAD_VERSION, LibPthreadVersion, sizeof(LibPthreadVersion) > 0)) {
- if (strstr(LibPthreadVersion, "NPTL")) {
- fprintf(stderr, "vdr: please turn off NPTL by setting 'export LD_ASSUME_KERNEL=2.4.1' before starting VDR\n");
- return 2;
- }
- }
-#endif
+ // Check for NPTL and re-exec if present - VDR apparently doesn't run well with NPTL:
+ {
+ size_t pth_l = confstr (_CS_GNU_LIBPTHREAD_VERSION, 0, 0);
+ char *pth = (char *)malloc (pth_l);
+ if (confstr (_CS_GNU_LIBPTHREAD_VERSION, pth, pth_l) > 0)
+ {
+ if (strstr (pth, "NPTL"))
+ {
+ setenv ("LD_ASSUME_KERNEL", "2.4.21", 1);
+ execve ("/proc/self/exe", argv, environ);
+ fprintf (stderr, "%s: couldn't re-exec myself: %s\n", argv[0], strerror (errno));
+ return 2;
+ }
+ }
+ free (pth);
+ }
// Check for UTF-8 and exit if present - asprintf() will fail if it encounters 8 bit ASCII codes
char *LangEnv;
diff -urNad vdr-1.3.10/plugin.c vdr-1.3.10/plugin.c
--- vdr-1.3.10/plugin.c 2004-06-17 02:27:08.000000000 +0100
+++ vdr-1.3.10/plugin.c 2004-06-17 02:29:09.000000000 +0100
@@ -120,6 +120,15 @@
args = Args ? strdup(Args) : NULL;
handle = NULL;
plugin = NULL;
+
+ // Replace all commas with spaces unless there are any spaces.
+ // => avoid some shell quoting problems where runvdr isn't a shell script.
+ if (!strchr (args, ' '))
+ {
+ char *p = args - 1;
+ while (p = strchr (p + 1, ','))
+ *p = ' ';
+ }
}
cDll::~cDll()
@@ -280,6 +289,8 @@
}
char *s = strdup(skipspace(Args));
char *p = strchr(s, ' ');
+ if (!p)
+ p = strchr (s, ','); // no space? try comma instead
if (p)
*p = 0;
char *buffer = NULL;
diff -urNad vdr-1.3.10/plugin.c vdr-1.3.10/plugin.c
--- vdr-1.3.10/plugin.c 2004-06-17 04:14:27.000000000 +0100
+++ vdr-1.3.10/plugin.c 2004-06-17 04:14:58.000000000 +0100
@@ -295,7 +295,13 @@
*p = 0;
char *buffer = NULL;
asprintf(&buffer, "%s/%s%s%s%s", directory, LIBVDR_PREFIX, s, SO_INDICATOR, VDRVERSION);
- dlls.Add(new cDll(buffer, Args));
+ struct stat st;
+ if (stat (buffer, &st) && errno == ENOENT) {
+ esyslog("WARN: missing plugin '%s'", s);
+ fprintf(stderr, "vdr: missing plugin '%s'\n", s);
+ }
+ else
+ dlls.Add(new cDll(buffer, Args));
free(buffer);
free(s);
}
Home |
Main Index |
Thread Index