Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/atf/dist/tools Allow env - atf-run to work by s...



details:   https://anonhg.NetBSD.org/src/rev/071d11546a2a
branches:  trunk
changeset: 1008683:071d11546a2a
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Mar 31 01:02:18 2020 +0000

description:
Allow env - atf-run to work by setting a default minimal path.

diffstat:

 external/bsd/atf/dist/tools/env.cpp |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (23 lines):

diff -r e07ee2aa5e2f -r 071d11546a2a external/bsd/atf/dist/tools/env.cpp
--- a/external/bsd/atf/dist/tools/env.cpp       Mon Mar 30 22:14:48 2020 +0000
+++ b/external/bsd/atf/dist/tools/env.cpp       Tue Mar 31 01:02:18 2020 +0000
@@ -48,9 +48,16 @@
 std::string
 impl::get(const std::string& name)
 {
-    const char* val = getenv(name.c_str());
-    assert(val != NULL);
-    return val;
+    const char *n =name.c_str();
+    const char* val = getenv(n);
+    if (val != NULL)
+       return val;
+    if (strcmp(n, "PATH") == 0)
+       return "/bin:/usr/bin";
+       
+    throw tools::system_error(IMPL_NAME "::set",
+                           "Cannot get environment variable '" + name +
+                           "'", errno);
 }
 
 bool



Home | Main Index | Thread Index | Old Index