On Fri, 13 Jan 2012 16:05:18 -0800, Gary Kline wrote:
> 
> excuse this slip of memory, but do you need the full path PLUS  the
> filename to use access? or just the filename?
> 
> say that i'm i n ~/tmp/foob and want to deetermine  wheether i can
> access file foob.  do i need to use "access("home/kline/tmp/foob", F_OK)"
> or will "access("foob", F_OK)"  do the trick?  i have already rub 
> "chdir("~/tmp")" in main(). please note.

According to what I read from "man 2 access" I would
assume it has to be an absolute path. When you read
to the faccessat() function, you'll see:

        The faccessat() system call is equivalent to
        access() except in the case where path specifies
        a relative path.  In this case the file whose
        accessibility is to be determined is located
        relative to the directory associated with the
        file descriptor fd instead of the current
        working directory.  If faccessat() is passed
        the special value AT_FDCWD in the fd parameter,
        the current working directory is used and the
        behavior is identical to a call to access().

Also see "SECURITY CONSIDERATIONS" later on.


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to