- passes/abc/abc.cc: #include <cerrno> for errno; use POSIX getcwd() for portability...
authorSiesh1oo <siesh1oo@siesh1oo.no>
Mon, 10 Mar 2014 13:35:53 +0000 (14:35 +0100)
committerSiesh1oo <siesh1oo@siesh1oo.no>
Mon, 10 Mar 2014 13:35:53 +0000 (14:35 +0100)
passes/abc/abc.cc

index 2829e660f8c59046bb99944c4b136dc4a331e47a..24a634f65d93d7673f7c7423428e1a724a883889 100644 (file)
@@ -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())