diff options
author | Siesh1oo <siesh1oo@siesh1oo.no> | 2014-03-10 14:35:53 +0100 |
---|---|---|
committer | Siesh1oo <siesh1oo@siesh1oo.no> | 2014-03-10 14:35:53 +0100 |
commit | f7c2cf6fe29fc452385c37f015e03febf650ecd3 (patch) | |
tree | 16c82482ed14e716b75dcaaa2d36acf1785539f2 | |
parent | 9b3d83359cc3f55049b5a48cb736a9a43bf04afc (diff) | |
download | yosys-f7c2cf6fe29fc452385c37f015e03febf650ecd3.tar.gz yosys-f7c2cf6fe29fc452385c37f015e03febf650ecd3.tar.bz2 yosys-f7c2cf6fe29fc452385c37f015e03febf650ecd3.zip |
- passes/abc/abc.cc: #include <cerrno> for errno; use POSIX getcwd() for portability (get_current_dir_name() does not exist on BSD).
-rw-r--r-- | passes/abc/abc.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/passes/abc/abc.cc b/passes/abc/abc.cc index 2829e660f..24a634f65 100644 --- a/passes/abc/abc.cc +++ b/passes/abc/abc.cc @@ -43,6 +43,7 @@ #include <stdio.h> #include <string.h> #include <dirent.h> +#include <cerrno> #include <sstream> #include "blifparse.h" @@ -973,7 +974,11 @@ struct AbcPass : public Pass { int lut_mode = 0; size_t argidx; - char *pwd = get_current_dir_name(); + char pwd [PATH_MAX]; + if (!getcwd(pwd, sizeof(pwd))) { + log_cmd_error("getcwd failed: %s\n", strerror(errno)); + log_abort(); + } for (argidx = 1; argidx < args.size(); argidx++) { std::string arg = args[argidx]; if (arg == "-exe" && argidx+1 < args.size()) { @@ -1020,7 +1025,6 @@ struct AbcPass : public Pass { } break; } - free(pwd); extra_args(args, argidx, design); if (lut_mode != 0 && !liberty_file.empty()) |