How to find what symlink points to?

Unga unga888 at yahoo.com
Mon Jul 27 13:45:15 UTC 2009


--- On Mon, 7/27/09, Erik Trulsson <ertr1013 at student.uu.se> wrote:

> From: Erik Trulsson <ertr1013 at student.uu.se>
> Subject: Re: How to find what symlink points to?
> To: "Unga" <unga888 at yahoo.com>
> Cc: freebsd-questions at freebsd.org
> Date: Monday, July 27, 2009, 9:36 PM
> On Mon, Jul 27, 2009 at 05:44:59AM
> -0700, Unga wrote:
> > 
> > Hi all
> > 
> > I need to remove some unwanted symlinks on /dev using
> a C program.
> > 
> > The "struct dirent" only shows the symlink name, how
> do I find what that
> > symlink points to for verification purpose?
> 
> By using the readlink(2) system call.
> 

But readlink(2) fails with errno set to 2. Can readlink(2) use with dev nodes?

Unga


      


More information about the freebsd-questions mailing list