Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] Re: Looking for osdteletext thread safe patch
On Sat, 2004-12-11 at 17:56 +0200, Jukka Tastula wrote:
> On Saturday 11 December 2004 14:21, guy.roussin@teledetection.fr wrote:
> > Hi,
> >
> > I'm looking for the osdteletext 0.4.1 patch witch
> > fixes the "readdir" poisoned ...
> > I search again and again in the safe thread and don't
> > find it :-(
>
> Looks like it simply doesn't exist.
I found the attached patch in my home dir, no idea where it came from.
diff -Naru osdteletext-0.4.1.orig/txtbitmap.c osdteletext-0.4.1/txtbitmap.c
--- osdteletext-0.4.1.orig/txtbitmap.c 2004-07-06 23:41:38.000000000 +0300
+++ osdteletext-0.4.1/txtbitmap.c 2004-12-05 13:23:56.302879942 +0200
@@ -189,8 +189,9 @@
char zeichen[9];
time_t t=time(0);
- struct tm* loct=localtime(&t);
- sprintf(zeichen, "%02d:%02d:%02d", loct->tm_hour, loct->tm_min, loct->tm_sec);
+ struct tm loct;
+ localtime_r(&t, &loct);
+ sprintf(zeichen, "%02d:%02d:%02d", loct.tm_hour, loct.tm_min, loct.tm_sec);
// paste them into the bitmap
diff -Naru osdteletext-0.4.1.orig/txtrecv.c osdteletext-0.4.1/txtrecv.c
--- osdteletext-0.4.1.orig/txtrecv.c 2004-07-24 23:35:09.000000000 +0300
+++ osdteletext-0.4.1/txtrecv.c 2004-12-05 13:08:57.796803403 +0200
@@ -9,6 +9,8 @@
***************************************************************************/
+#include <dirent.h>
+
#include "txtrecv.h"
#include "tables.h"
#include "setup.h"
@@ -19,7 +21,6 @@
#include <pthread.h>
#include <signal.h>
#include <errno.h>
-#include <dirent.h>
#include <sys/vfs.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -39,10 +40,10 @@
DIR *top=opendir(root);
int pagesDeleted=0;
if (top) {
- struct dirent *chandir;
+ struct dirent *chandir, path;
struct stat chandirstat;
char fullPath[PATH_MAX];
- while ( (chandir=readdir(top)) ) {
+ while ( (!readdir_r(top, &path, &chandir) && chandir != NULL) ) {
if (strcmp(chandir->d_name, "..")==0 || strcmp(chandir->d_name, ".")==0)
continue;
snprintf(fullPath, PATH_MAX, "%s/%s", root, chandir->d_name);
@@ -65,10 +66,10 @@
bool hadError=false;
int bytesDeleted=0, filesize;
if (d) {
- struct dirent *txtfile;
+ struct dirent *txtfile, path;
struct stat txtfilestat;
char fullPath[PATH_MAX];
- while ( (txtfile=readdir(d)) ) {
+ while ( (!readdir_r(d, &path, &txtfile) && txtfile != NULL) ) {
int len=strlen(txtfile->d_name);
//check that the file end with .vtx to avoid accidents and disasters
if (strcmp(txtfile->d_name+len-4, ".vtx")==0) {
@@ -150,9 +151,9 @@
int haveDir=0;
DIR *top=opendir(getRootDir());
if (top) {
- struct dirent *chandir;
+ struct dirent *chandir, path;
struct stat chandirstat;
- while ( (chandir=readdir(top)) ) {
+ while ( (!readdir_r(top, &path, &chandir) && chandir != NULL) ) {
if (strcmp(chandir->d_name, "..")==0 || strcmp(chandir->d_name, ".")==0)
continue;
snprintf(fullPath, PATH_MAX, "%s/%s", getRootDir(), chandir->d_name);
Home |
Main Index |
Thread Index