[LCP]directory test - resolved

Joachim Bauernberger bj at gmx.net
Tue Jul 9 19:51:05 UTC 2002


Hi again,
I found it in the glibc manual.

int dirfd (DIR *dirstream)
.....          
The function dirfd returns the file descriptor associated with the 
directory stream dirstream. This descriptor can be used until the 
directory is closed with closedir. If the directory stream 
implementation is not using file descriptors the return value is -1.
...

Thanks,
Joachim Bauernberger

On Tuesday 09 July 2002 11:28, Joachim Bauernberger wrote:
> Hi,
> 
> I have some questions regarding opendir.
> After calling it I would like to check if the directory is a symbolic 
> name or not. However compiling this gives me the following error:
> 
> dereferencing pointer to incomplete type
> 
> 
> int
> islink(int fd)
> {
>     struct stat st;
>     if ((fstat(fd,&st))<0) return -1;
>     if (S_ISLNK(st.st_mode)) return 1;
>     else return 0;
> }
> 
> 
> void
> otherfunc(void)
> {
>  DIR *d;
>   ....
>   d = opendir (abs_outdir);
>   ...
>   if (islink(d->dd_fd)!=0)  return 1;
>   ....
> }
> 
> Somebody know how to check for something like this?
> 
> Thanks & Best regards,
> Joachim Bauernberger
> -- 
> http://mXscan.org/pgp/joachim.html
> 
> 
> 
> _______________________________________________
> This is the Linux C Programming List
> :  http://lists.linux.org.au/listinfo/linuxcprogramming List
> 
> 

-- 
http://mXscan.org/pgp/joachim.html




More information about the linuxCprogramming mailing list