diff options
author | Jochen Dolze <vdr@dolze.de> | 2010-07-08 21:43:23 +0200 |
---|---|---|
committer | Jochen Dolze <vdr@dolze.de> | 2010-07-08 21:43:23 +0200 |
commit | 800fdfef53335279b99db9118f6b2972c957376b (patch) | |
tree | 225031732d25db206581918bfd8354c1cf5c0c2c /command | |
parent | 0f47971de0782234b534ec623203b56684d80c52 (diff) | |
download | vdr-plugin-markad-800fdfef53335279b99db9118f6b2972c957376b.tar.gz vdr-plugin-markad-800fdfef53335279b99db9118f6b2972c957376b.tar.bz2 |
Corrected info/info.vdr will now be saved
Added compatibility for GCC3.x
Diffstat (limited to 'command')
-rw-r--r-- | command/markad-standalone.cpp | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/command/markad-standalone.cpp b/command/markad-standalone.cpp index 26bd2c8..f736bd8 100644 --- a/command/markad-standalone.cpp +++ b/command/markad-standalone.cpp @@ -1027,12 +1027,12 @@ bool cMarkAdStandalone::SaveInfo(const char *Directory) FILE *r,*w; r=fopen(src,"r"); - free(src); w=fopen(dst,"w+"); if ((!r) || (!w)) { + free(src); free(dst); return false; } @@ -1125,19 +1125,19 @@ bool cMarkAdStandalone::SaveInfo(const char *Directory) if ((setVideo43) && (!setVideo43_done) && (!err)) { - if (fprintf(w,"%s","X 1 01 deu 4:3\n")<=0) err=true; + if (fprintf(w,"%s","X 1 01 und 4:3\n")<=0) err=true; } if ((setVideo169) && (!setVideo169_done) && (!err)) { - if (fprintf(w,"%s","X 1 03 deu 16:9\n")<=0) err=true; + if (fprintf(w,"%s","X 1 03 und 16:9\n")<=0) err=true; } if ((setAudio20) && (!setAudio20_done) && (!err)) { - if (fprintf(w,"%s","X 2 05 deu Dolby Digital 2.0\n")<=0) err=true; + if (fprintf(w,"%s","X 2 05 und Dolby Digital 2.0\n")<=0) err=true; } if ((setAudio51) && (!setAudio51_done) && (!err)) { - if (fprintf(w,"%s","X 2 05 deu Dolby Digital 5.1\n")<=0) err=true; + if (fprintf(w,"%s","X 2 05 und Dolby Digital 5.1\n")<=0) err=true; } if (line) if (fprintf(w,"%s",line)<=0) err=true; if (line) free(line); @@ -1147,6 +1147,27 @@ bool cMarkAdStandalone::SaveInfo(const char *Directory) { unlink(dst); } + else + { + if (rename(dst,src)==-1) err=true; + } + + if ((getuid()==0 || geteuid()!=0) && (!err)) + { + // if we are root, set fileowner to owner of 001.vdr/00001.ts file + char *spath=NULL; + if (asprintf(&spath,"%s/%s",Directory,isTS ? "00001.ts" : "001.vdr")!=-1) + { + struct stat statbuf; + if (!stat(spath,&statbuf)) + { + if (chown(src,statbuf.st_uid, statbuf.st_gid)) {}; + } + free(spath); + } + } + + free(src); free(dst); return (err==false); } |