<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&#39;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&#39;s a link...</div><div><br></div><div><div>r = readlink(strcat(p-&gt;fts_path,p-&gt;fts_name),buf,sizeof(buf)-1);</div><div>if (r&gt;0){</div><div>
  buf[r]=&#39;\0&#39;;</div><div>  printf(&quot; %-s -&gt; %s&quot;,p-&gt;fts_name,buf);</div><div>}else</div><div>  printf(&quot; %-s -&gt; %s&quot;,p-&gt;fts_name,&quot;Could&#39;t read link&quot;);</div></div><div><br>
</div><div>Again, this works the first time it&#39;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">&lt;<a href="mailto:tnadkarn@stevens.edu" target="_blank">tnadkarn@stevens.edu</a>&gt;</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&#39;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&#39;ve run into existing symlinks that don&#39;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 &quot;./ls -l /etc/&quot; on my Ubuntu VM....</div><div><br></div><div>It works on this...</div><div>blkid.tab -&gt; /dev/.blkid.tab<br>

</div><div><br></div><div><br></div><div>but not on this...</div><div><br></div><div><div>vtrgb -&gt; Could&#39;t read link</div></div><div><br></div><div>and many others.</div><div><br></div><div>I&#39;ve had no issues on symlinks I&#39;ve created so far.</div>

<div><br></div><div>Thoughts?</div><div><br></div></div>
</blockquote></div><br></div>