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/2247d827c981
branches: trunk
changeset: 746417:2247d827c981
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 09a927e3ddbb -r 2247d827c981 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