Unix Programming - file system question

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > October 2004 > file system question





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author file system question
Janice

2004-10-25, 5:52 pm

I use ls -l to list a file which is a link. I got the following.
/lib/terminfo.lnk -> ../share/terminfo
If I use stat("/lib/terminfo.lnk",buf), I get errno=2, which means No such
file or directory.
What is the reason for this contradictory result?
Thanx


Dragan Cvetkovic

2004-10-25, 5:52 pm

"Janice" <no@mail.com> writes:

> I use ls -l to list a file which is a link. I got the following.
> /lib/terminfo.lnk -> ../share/terminfo
> If I use stat("/lib/terminfo.lnk",buf), I get errno=2, which means No such
> file or directory.
> What is the reason for this contradictory result?


There is no contradiction here. Your soft links could point anywhere.

E.g.

% ln -s /doesntexist/doesntexist a
% ls -lgo a
lrwxrwxrwx 1 24 Oct 25 12:35 a -> /doesntexist/doesntexist


stat() call follows the link (lstat() doesn't). Does /share/terminfo exist
on your system?

Bye, Dragan

--
Dragan Cvetkovic,

To be or not to be is true. G. Boole No it isn't. L. E. J. Brouwer

!!! Sender/From address is bogus. Use reply-to one !!!
Janice

2004-10-25, 5:52 pm

Thank you for your reply.
The /share/terminfo doesnt exist.
Thank you for telling me the different between lstat and stat.

"Dragan Cvetkovic" <me@privacy.net> ???????:lmu0sidacj.fsf@privacy.net...
> "Janice" <no@mail.com> writes:
>
such[vbcol=seagreen]
>
> There is no contradiction here. Your soft links could point anywhere.
>
> E.g.
>
> % ln -s /doesntexist/doesntexist a
> % ls -lgo a
> lrwxrwxrwx 1 24 Oct 25 12:35 a -> /doesntexist/doesntexist
>
>
> stat() call follows the link (lstat() doesn't). Does /share/terminfo exist
> on your system?
>
> Bye, Dragan
>
> --
> Dragan Cvetkovic,
>
> To be or not to be is true. G. Boole No it isn't. L. E. J. Brouwer
>
> !!! Sender/From address is bogus. Use reply-to one !!!



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com