Mike Meyer <[EMAIL PROTECTED]> writes:
> However, you can also make a best effort. Check argv[0] to see if you
> have an absolute path. If not, do what the shell would do to find the
> executable - look for it on $PATH. Once you've found it, call
> realpath(3) to canonicalize the path.

You got it the wrong way around.  First pass argv[0] to realpath(3),
fall back to using $PATH only if realpath(3) fails (which it shouldn't
unless you've called chdir(2), chroot(2) or jail(2) earlier in the
process, or the executable was moved or removed)

DES
-- 
Dag-Erling Smørgrav - [EMAIL PROTECTED]
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to