testing for directory
rsmith at xs4all.nl
Sun Apr 29 20:58:50 UTC 2007
On Sun, Apr 29, 2007 at 04:39:42PM -0400, Robert Huff wrote:
> In C code, is there a quick and dirty way to tell if a path
> points to a directory? Or do I have to open the parent directory and
> check the entry for that name?
Try opening the path in question for writing with open(2). If it returns
-1, and errno is EISDIR, it is a directory.
This will be inconclusive on a read-only filesystem, or if the limit of
open file handles is reached, or for any other reason that can make
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20070429/8da546ba/attachment.pgp
More information about the freebsd-questions