mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Fixed following symbolic links in RemoveFileOrDir() (cont'd)
This commit is contained in:
parent
12870faf87
commit
208b703e5b
@ -740,6 +740,7 @@ Steffen Barszus <st_barszus@gmx.de>
|
|||||||
or Makefile.config as defaults
|
or Makefile.config as defaults
|
||||||
for helping to debug a crash when using the --terminal option without having access
|
for helping to debug a crash when using the --terminal option without having access
|
||||||
to the given terminal
|
to the given terminal
|
||||||
|
for fixing following symbolic links in RemoveFileOrDir()
|
||||||
|
|
||||||
Peter Seyringer <e9425234@student.tuwien.ac.at>
|
Peter Seyringer <e9425234@student.tuwien.ac.at>
|
||||||
for reporting a bug in saving the polarization parameter of channels that have a
|
for reporting a bug in saving the polarization parameter of channels that have a
|
||||||
|
2
HISTORY
2
HISTORY
@ -6484,3 +6484,5 @@ Video Disk Recorder Revision History
|
|||||||
2010-10-24: Version 1.7.17
|
2010-10-24: Version 1.7.17
|
||||||
|
|
||||||
- Updated the Estonian OSD texts (thanks to Arthur Konovalov).
|
- Updated the Estonian OSD texts (thanks to Arthur Konovalov).
|
||||||
|
- Fixed following symbolic links in RemoveFileOrDir() (cont'd) (thanks to
|
||||||
|
Steffen Barszus).
|
||||||
|
8
tools.c
8
tools.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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"
|
#include "tools.h"
|
||||||
@ -368,7 +368,7 @@ bool RemoveFileOrDir(const char *FileName, bool FollowSymlinks)
|
|||||||
cString buffer = AddDirectory(FileName, e->d_name);
|
cString buffer = AddDirectory(FileName, e->d_name);
|
||||||
if (FollowSymlinks) {
|
if (FollowSymlinks) {
|
||||||
struct stat st2;
|
struct stat st2;
|
||||||
if (stat(buffer, &st2) == 0) {
|
if (lstat(buffer, &st2) == 0) {
|
||||||
if (S_ISLNK(st2.st_mode)) {
|
if (S_ISLNK(st2.st_mode)) {
|
||||||
int size = st2.st_size + 1;
|
int size = st2.st_size + 1;
|
||||||
char *l = MALLOC(char, size);
|
char *l = MALLOC(char, size);
|
||||||
@ -377,14 +377,12 @@ bool RemoveFileOrDir(const char *FileName, bool FollowSymlinks)
|
|||||||
if (errno != EINVAL)
|
if (errno != EINVAL)
|
||||||
LOG_ERROR_STR(*buffer);
|
LOG_ERROR_STR(*buffer);
|
||||||
}
|
}
|
||||||
else if (n < size) {
|
else {
|
||||||
l[n] = 0;
|
l[n] = 0;
|
||||||
dsyslog("removing %s", l);
|
dsyslog("removing %s", l);
|
||||||
if (remove(l) < 0)
|
if (remove(l) < 0)
|
||||||
LOG_ERROR_STR(l);
|
LOG_ERROR_STR(l);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
esyslog("ERROR: symlink name length (%d) exceeded anticipated buffer size (%d)", n, size);
|
|
||||||
free(l);
|
free(l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user