On 13.02.2012 12:54, Klaus Schmidinger wrote:
On 13.02.2012 12:27, Lucian Muresan wrote:
On 13.02.2012 12:00, Klaus Schmidinger wrote:
[...]
Now I looked a bit closer, and noticed that the "first" call to stat is actually not to *stat*, but to *lstat* in vanilla vdr-1.7.23, so if you remove the call to the second one, could it be that you're not really cutting redundancy, maybe it actually makes a difference?
Now you got me ;-) I had switched back to 'stat()' instead of 'lstat()' and forgotten to reintroduce the 'lstat()'. Therefore I saw two identical calls to stat(). With the first call being lstat(), the second call to stat() is of course necessary for the following S_ISDIR() check.
Sorry for the confusion, and thanks for clarifying this. So now this whole code sequence looks like this:
if (lstat(buffer, &st) == 0) { int Link = 0; if (S_ISLNK(st.st_mode)) { if (LinkLevel > MAX_LINK_LEVEL) { isyslog("max link level exceeded - not scanning %s", *buffer); continue; } Link = 1; if (stat(buffer, &st) != 0) continue; }
No problem at all, I'm glad it's now sorted out for the next developer version.
Lucian