summaryrefslogtreecommitdiff
path: root/tools.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2010-10-24 11:33:46 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2010-10-24 11:33:46 +0200
commit208b703e5b9f0ae39e1f6355083bc1a7c6b08005 (patch)
treef13d64a0a2357fab25e7391197b7f379831d67cc /tools.c
parent12870faf87a7f645ce9c957b6f1c45ca49ea087f (diff)
downloadvdr-208b703e5b9f0ae39e1f6355083bc1a7c6b08005.tar.gz
vdr-208b703e5b9f0ae39e1f6355083bc1a7c6b08005.tar.bz2
Fixed following symbolic links in RemoveFileOrDir() (cont'd)
Diffstat (limited to 'tools.c')
-rw-r--r--tools.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/tools.c b/tools.c
index 3ce12ec5..09053301 100644
--- a/tools.c
+++ b/tools.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.c 2.8 2010/08/29 15:03:08 kls Exp $
+ * $Id: tools.c 2.9 2010/10/24 11:32:27 kls Exp $
*/
#include "tools.h"
@@ -368,7 +368,7 @@ bool RemoveFileOrDir(const char *FileName, bool FollowSymlinks)
cString buffer = AddDirectory(FileName, e->d_name);
if (FollowSymlinks) {
struct stat st2;
- if (stat(buffer, &st2) == 0) {
+ if (lstat(buffer, &st2) == 0) {
if (S_ISLNK(st2.st_mode)) {
int size = st2.st_size + 1;
char *l = MALLOC(char, size);
@@ -377,14 +377,12 @@ bool RemoveFileOrDir(const char *FileName, bool FollowSymlinks)
if (errno != EINVAL)
LOG_ERROR_STR(*buffer);
}
- else if (n < size) {
+ else {
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);
}
}