This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Cannot exec() program outside of /bin if PATH is unset
- From: Csaba Raduly <rcsaba at gmail dot com>
- To: cygwin list <cygwin at cygwin dot com>
- Date: Sun, 14 Sep 2014 11:09:25 +0200
- Subject: Re: Cannot exec() program outside of /bin if PATH is unset
- Authentication-results: sourceware.org; auth=none
- References: <5413271B dot 1010109 at t-online dot de> <54134A83 dot 80107 at redhat dot com>
On Fri, Sep 12, 2014 at 9:33 PM, Eric Blake wrote:
> On 09/12/2014 11:02 AM, Christian Franke wrote:
(snip)
>>
>> int main()
>> {
>> unsetenv("PATH");
>
> This is undefined behavior, per POSIX. POSIX recommends that you always
> leave PATH defined to at least a bare minimum of the results of
> confstr(_CS_PATH, ...); it also states that implementations are free to
> do what they want (in this case, crash) if you don't follow the
> recommendation:
>
> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html
> "If PATH is unset or is set to null, the path search is
> implementation-defined."
Nitpick: undefined != implementation-defined
Csaba
--
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple