mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 19:18:19 +00:00
Fix a build failure on OpenBSD
The wordexp function doesn't exist in OpenBSD. Skipping this functionality only affects users who have bro installed in a directory in the PATH and the directory name as it appears in PATH starts with a tilde (e.g. "~/bin"). A simple workaround for affected users would be to change the PATH environment variable to not contain any tildes.
This commit is contained in:
parent
de1c13e3a3
commit
31e46d37f0
1 changed files with 8 additions and 1 deletions
|
@ -6,7 +6,9 @@
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#if !defined(__OpenBSD__)
|
||||||
#include <wordexp.h>
|
#include <wordexp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace broxygen;
|
using namespace broxygen;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -66,9 +68,11 @@ Manager::Manager(const string& arg_config, const string& bro_command)
|
||||||
|
|
||||||
const char* env_path = getenv("PATH");
|
const char* env_path = getenv("PATH");
|
||||||
string path = env_path ? string(env_path) + ":." : ".";
|
string path = env_path ? string(env_path) + ":." : ".";
|
||||||
|
string path_to_bro;
|
||||||
|
|
||||||
|
#if !defined(__OpenBSD__)
|
||||||
wordexp_t expanded_path;
|
wordexp_t expanded_path;
|
||||||
wordexp(path.c_str(), &expanded_path, WRDE_NOCMD);
|
wordexp(path.c_str(), &expanded_path, WRDE_NOCMD);
|
||||||
string path_to_bro;
|
|
||||||
|
|
||||||
if ( expanded_path.we_wordc == 1 )
|
if ( expanded_path.we_wordc == 1 )
|
||||||
path_to_bro = find_file(bro_command, expanded_path.we_wordv[0]);
|
path_to_bro = find_file(bro_command, expanded_path.we_wordv[0]);
|
||||||
|
@ -77,6 +81,9 @@ Manager::Manager(const string& arg_config, const string& bro_command)
|
||||||
reporter->InternalWarning("odd expansion of path: %s\n", path.c_str());
|
reporter->InternalWarning("odd expansion of path: %s\n", path.c_str());
|
||||||
path_to_bro = find_file(bro_command, path);
|
path_to_bro = find_file(bro_command, path);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
path_to_bro = find_file(bro_command, path);
|
||||||
|
#endif
|
||||||
|
|
||||||
struct stat s;
|
struct stat s;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue