diff options
author | Klaus Schmidinger <Klaus (dot) Schmidinger (at) tvdr (dot) de> | 2010-09-19 16:00:00 +0200 |
---|---|---|
committer | Klaus Schmidinger <Klaus (dot) Schmidinger (at) tvdr (dot) de> | 2010-09-19 16:00:00 +0200 |
commit | 58db02442b375f5669416e6e744a8325ed363f99 (patch) | |
tree | c254912dffebfa6197c0a0a699ae79add7b85ef0 /tools.c | |
parent | c2c45d68c644684e002a92ceee83af7550aaa1e4 (diff) | |
download | vdr-patch-lnbsharing-vdr-1.7.16.tar.gz vdr-patch-lnbsharing-vdr-1.7.16.tar.bz2 |
Version 1.7.16vdr-1.7.16
- Updated the Italian OSD texts (thanks to Diego Pierotto).
- Added missing Dtypes for ATSC (thanks to Alex Lasnier).
- Updated the Portuguese language texts (thanks to Cristiano A. Silva).
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
- Fixed the array size of Atypes in cPatFilter::Process() (thanks to
Rolf Ahrenberg).
- Added locking to the cCutter functions to avoid a crash in case CutRecording()
is called from a plugin (reported by Andreas Mair).
- Fixed DDS detection for HD resolution subtitles (thanks to Reinhard Nissl).
- Fixed following symbolic links in RemoveFileOrDir().
- Added support for languages that are written right-to-left (based on a patch
from Osama Alrawab). See INSTALL for information on how to turn this on.
- Added Arabian language texts (thanks to Osama Alrawab).
Diffstat (limited to 'tools.c')
-rw-r--r-- | tools.c | 39 |
1 files changed, 24 insertions, 15 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.c 2.7 2010/02/28 13:31:46 kls Exp $ + * $Id: tools.c 2.8 2010/08/29 15:03:08 kls Exp $ */ #include "tools.h" @@ -367,22 +367,31 @@ bool RemoveFileOrDir(const char *FileName, bool FollowSymlinks) if (strcmp(e->d_name, ".") && strcmp(e->d_name, "..")) { cString buffer = AddDirectory(FileName, e->d_name); if (FollowSymlinks) { - int size = strlen(buffer) * 2; // should be large enough - char *l = MALLOC(char, size); - int n = readlink(buffer, l, size); - if (n < 0) { - if (errno != EINVAL) - LOG_ERROR_STR(*buffer); + struct stat st2; + if (stat(buffer, &st2) == 0) { + if (S_ISLNK(st2.st_mode)) { + int size = st2.st_size + 1; + char *l = MALLOC(char, size); + int n = readlink(buffer, l, size - 1); + if (n < 0) { + if (errno != EINVAL) + LOG_ERROR_STR(*buffer); + } + else if (n < size) { + l[n] = 0; + dsyslog("removing %s", l); + if (remove(l) < 0) + LOG_ERROR_STR(l); + } + else + esyslog("ERROR: symlink name length (%d) exceeded anticipated buffer size (%d)", n, size); + free(l); + } } - else if (n < size) { - l[n] = 0; - dsyslog("removing %s", l); - if (remove(l) < 0) - LOG_ERROR_STR(l); + else if (errno != ENOENT) { + LOG_ERROR_STR(FileName); + return false; } - else - esyslog("ERROR: symlink name length (%d) exceeded anticipated buffer size (%d)", n, size); - free(l); } dsyslog("removing %s", *buffer); if (remove(buffer) < 0) |