mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Fixed handling relative link targets in the ReadLink() function
This commit is contained in:
parent
182224b65f
commit
9fe7b98cdb
@ -1794,6 +1794,7 @@ Ingo Schneider <mail@ingo-schneider.de>
|
|||||||
|
|
||||||
Patrick Cernko <errror@errror.org>
|
Patrick Cernko <errror@errror.org>
|
||||||
for suggesting to add a note about "modprobe capability" to INSTALL
|
for suggesting to add a note about "modprobe capability" to INSTALL
|
||||||
|
for reporting a problem with relative link targets in the ReadLink() function
|
||||||
|
|
||||||
Philippe Gramoullé <philippe@gramoulle.com>
|
Philippe Gramoullé <philippe@gramoulle.com>
|
||||||
for reporting a a missing '-' in the example for viewing a grabbed image on a remote
|
for reporting a a missing '-' in the example for viewing a grabbed image on a remote
|
||||||
|
4
HISTORY
4
HISTORY
@ -4783,7 +4783,7 @@ Video Disk Recorder Revision History
|
|||||||
so that they can be suppressed in normal operation mode to avoid clogging the
|
so that they can be suppressed in normal operation mode to avoid clogging the
|
||||||
log file in case this function is used frequently (suggested by Helmut Auer).
|
log file in case this function is used frequently (suggested by Helmut Auer).
|
||||||
|
|
||||||
2006-06-16: Version 1.4.1-1
|
2006-06-17: Version 1.4.1-1
|
||||||
|
|
||||||
- Added "-fPIC" to the compiler options in Make.config.template when compiling
|
- Added "-fPIC" to the compiler options in Make.config.template when compiling
|
||||||
plugins (thanks to Udo Richter). If you use your own Make.config file, you may
|
plugins (thanks to Udo Richter). If you use your own Make.config file, you may
|
||||||
@ -4797,3 +4797,5 @@ Video Disk Recorder Revision History
|
|||||||
- Modified rcu.c to better handle RC5 codes.
|
- Modified rcu.c to better handle RC5 codes.
|
||||||
- Added a missing variable initialization in cRingBufferLinear::cRingBufferLinear()
|
- Added a missing variable initialization in cRingBufferLinear::cRingBufferLinear()
|
||||||
(thanks to Prakash Punnoor).
|
(thanks to Prakash Punnoor).
|
||||||
|
- Fixed handling relative link targets in the ReadLink() function (reported by
|
||||||
|
Patrick Cernko).
|
||||||
|
22
tools.c
22
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 1.118 2006/05/26 10:10:31 kls Exp $
|
* $Id: tools.c 1.119 2006/06/17 09:45:32 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
@ -480,22 +480,16 @@ int DirSizeMB(const char *DirName)
|
|||||||
|
|
||||||
char *ReadLink(const char *FileName)
|
char *ReadLink(const char *FileName)
|
||||||
{
|
{
|
||||||
char RealName[PATH_MAX];
|
if (!FileName)
|
||||||
const char *TargetName = NULL;
|
return NULL;
|
||||||
int n = readlink(FileName, RealName, sizeof(RealName) - 1);
|
char *TargetName = canonicalize_file_name(FileName);
|
||||||
if (n < 0) {
|
if (!TargetName) {
|
||||||
if (errno == ENOENT || errno == EINVAL) // file doesn't exist or is not a symlink
|
if (errno == ENOENT) // file doesn't exist
|
||||||
TargetName = FileName;
|
TargetName = strdup(FileName);
|
||||||
else // some other error occurred
|
else // some other error occurred
|
||||||
LOG_ERROR_STR(FileName);
|
LOG_ERROR_STR(FileName);
|
||||||
}
|
}
|
||||||
else if (n < int(sizeof(RealName))) { // got it!
|
return TargetName;
|
||||||
RealName[n] = 0;
|
|
||||||
TargetName = RealName;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
esyslog("ERROR: symlink's target name too long: %s", FileName);
|
|
||||||
return TargetName ? strdup(TargetName) : NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SpinUpDisk(const char *FileName)
|
bool SpinUpDisk(const char *FileName)
|
||||||
|
Loading…
Reference in New Issue
Block a user