<div dir="ltr">I take it back, it seems to work the first time but on future calls it fails! This is stumping me. Here's my code. This is called for each directory entry when using longformat.<div><br></div><div><div>char buf [PATH_MAX];</div>
<div>int r=0;</div></div><div>.</div><div>.</div><div>.</div><div>if it's a link...</div><div><br></div><div><div>r = readlink(strcat(p->fts_path,p->fts_name),buf,sizeof(buf)-1);</div><div>if (r>0){</div><div>
buf[r]='\0';</div><div> printf(" %-s -> %s",p->fts_name,buf);</div><div>}else</div><div> printf(" %-s -> %s",p->fts_name,"Could't read link");</div></div><div><br>
</div><div>Again, this works the first time it's run but after that fails!! :)</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Oct 5, 2013 at 8:59 PM, Tejas Nadkarni <span dir="ltr"><<a href="mailto:tnadkarn@stevens.edu" target="_blank">tnadkarn@stevens.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'm using readlink to read symlinks to determine their actual target and print it out as part of the longformat. This seems to work for links I create but I've run into existing symlinks that don't work and I believe is a permissions issue.<div>
<br></div><div>How are you handling this? </div><div><br></div><div>for example if I run "./ls -l /etc/" on my Ubuntu VM....</div><div><br></div><div>It works on this...</div><div>blkid.tab -> /dev/.blkid.tab<br>
</div><div><br></div><div><br></div><div>but not on this...</div><div><br></div><div><div>vtrgb -> Could't read link</div></div><div><br></div><div>and many others.</div><div><br></div><div>I've had no issues on symlinks I've created so far.</div>
<div><br></div><div>Thoughts?</div><div><br></div></div>
</blockquote></div><br></div>