Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] Re: solved: segment faults from osdtelext plugin
Darren Salt wrote:
I demand that C.Y.M may or may not have written...
Darren Salt wrote:
I demand that Rainer Zocholl may or may not have written...
After replacing all obviously/known not thread save clib calls with their
thread save counterparts osdteletext now runs!
[snip]
I've gone through and recompiled vdr and the plugins which are installed
here, based on what you've done. Patches attached (note that vdr-remote
didn't need to be patched).
I have found a few more plugins that require "safe" threading fixes.
Steamdev, Text2skin, and MP3. Attached are the following errors after
poisoning.
MP3 Plugin:
player-mp3.c:720:16: attempt to use poisoned "rand"
make[1]: *** [player-mp3.o] Error 1
That seems trivial. (I wonder if rand() really should be poisoned...)
Streamdev:
ccache g++ -g -O2 -Wall -Woverloaded-virtual -O2 -c -D_GNU_SOURCE
-DHAVE_AUTOPID -I../../../include -I../DVB/include -I. -o common.o common.c
In file included from /usr/include/c++/3.3/cwchar:51,
[snip]
Out-of-order #includes. Move the others before the VDR includes and all
should be well.
Text2Skin:
/usr/include/dirent.h:155:23: attempt to use poisoned "readdir"
Same here...
loader.c:19:31: attempt to use poisoned "readdir"
make[1]: *** [loader.o] Error 1
Another easy one - go on, fix it ;-)
Here are some fixes for streamdev, mp3, and text2skin plugins after
poisoning. :)
BTW, this is untested, so please let me know if I messed it up. Atleast
it compiles now :)
Regards,
--- loader.c.orig 2004-12-04 15:42:24.000000000 -0800
+++ loader.c 2004-12-04 16:03:48.000000000 -0800
@@ -2,6 +2,7 @@
* $Id: loader.c,v 1.12 2004/06/22 16:48:03 lordjaxom Exp $
*/
+#include <dirent.h>
#include "loader.h"
#include "data.h"
#include "i18n.h"
@@ -10,13 +11,12 @@
#include "text2skin.h"
#include <vdr/plugin.h>
#include <sys/types.h>
-#include <dirent.h>
void cText2SkinLoader::Start(void) {
DIR *d = opendir(SkinPath());
if (d) {
- struct dirent *ent;
- while ((ent = readdir(d)) != NULL) {
+ struct dirent *ent, path;
+ while (!readdir_r(d, &path, &ent) && ent != NULL) {
char *path;
struct stat buf;
if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0)
diff -ruN streamdev-0.3.3-pre3-geni-3-orig/client/device.c streamdev-0.3.3-pre3-geni-3/client/device.c
--- streamdev-0.3.3-pre3-geni-3-orig/client/device.c 2004-12-04 17:32:50.000000000 -0800
+++ streamdev-0.3.3-pre3-geni-3/client/device.c 2004-12-04 17:38:42.000000000 -0800
@@ -2,6 +2,14 @@
* $Id: device.c,v 1.10 2004/08/17 14:47:26 lordjaxom Exp $
*/
+#include <time.h>
+#include <iostream>
+
+#include <vdr/channels.h>
+#include <vdr/ringbuffer.h>
+#include <vdr/eit.h>
+#include <vdr/timers.h>
+
#include "client/device.h"
#include "client/setup.h"
#include "client/assembler.h"
@@ -10,14 +18,6 @@
#include "tools/select.h"
#include "tools/string.h"
-#include <vdr/channels.h>
-#include <vdr/ringbuffer.h>
-#include <vdr/eit.h>
-#include <vdr/timers.h>
-
-#include <time.h>
-#include <iostream>
-
using namespace std;
#define VIDEOBUFSIZE MEGABYTE(3)
diff -ruN streamdev-0.3.3-pre3-geni-3-orig/common.c streamdev-0.3.3-pre3-geni-3/common.c
--- streamdev-0.3.3-pre3-geni-3-orig/common.c 2004-12-04 17:39:54.000000000 -0800
+++ streamdev-0.3.3-pre3-geni-3/common.c 2004-12-04 17:44:59.000000000 -0800
@@ -2,8 +2,8 @@
* $Id: common.c,v 1.10 2004/08/17 15:29:56 lordjaxom Exp $
*/
-#include <vdr/channels.h>
#include <iostream>
+#include <vdr/channels.h>
#include "common.h"
#include "tools/select.h"
diff -ruN mp3-0.9.8-orig/decoder.c mp3-0.9.8/decoder.c
--- mp3-0.9.8-orig/decoder.c 2004-12-04 16:19:01.000000000 -0800
+++ mp3-0.9.8/decoder.c 2004-12-04 17:20:39.000000000 -0800
@@ -410,8 +410,9 @@
cFileInfo::Clear();
cSongInfo::Clear();
while(fgets(buf,sizeof(buf),f)) {
- char *name =strtok(buf ,delimiters);
- char *value=strtok(0,delimiters);
+ char * lasts=NULL;
+ char *name =strtok_r(buf ,delimiters, &lasts);
+ char *value=strtok_r(0,delimiters, &lasts);
if(name) {
if(!strcasecmp(name,"##END")) break;
if(value) {
diff -ruN mp3-0.9.8-orig/player-mp3.c mp3-0.9.8/player-mp3.c
--- mp3-0.9.8-orig/player-mp3.c 2004-12-04 16:14:31.000000000 -0800
+++ mp3-0.9.8/player-mp3.c 2004-12-04 17:29:43.000000000 -0800
@@ -717,7 +717,8 @@
int in=Index(curr)+1; if(in<0) in=0;
if((max-in)>=2) {
for(int i=in ; i<max ; i++) {
- int ran=(rand() % ((max-in)*4-4))/4; ran+=((ran+in) >= i);
+ unsigned int seedp;
+ int ran=(rand_r(&seedp) % ((max-in)*4-4))/4; ran+=((ran+in) >= i);
int t=shuffle[i];
shuffle[i]=shuffle[ran+in];
shuffle[ran+in]=t;
Home |
Main Index |
Thread Index