Module Name:    src
Committed By:   christos
Date:           Tue Mar 31 01:02:18 UTC 2020

Modified Files:
        src/external/bsd/atf/dist/tools: env.cpp

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


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/atf/dist/tools/env.cpp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/tools/env.cpp
diff -u src/external/bsd/atf/dist/tools/env.cpp:1.2 src/external/bsd/atf/dist/tools/env.cpp:1.3
--- src/external/bsd/atf/dist/tools/env.cpp:1.2	Tue Feb 11 12:28:20 2014
+++ src/external/bsd/atf/dist/tools/env.cpp	Mon Mar 30 21:02:18 2020
@@ -48,9 +48,16 @@ namespace impl = tools::env;
 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

Reply via email to