diff options
author | Clifford Wolf <clifford@clifford.at> | 2015-01-06 15:46:58 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2015-01-06 15:46:58 +0100 |
commit | 9fb715dc74b632c74aafec1652d4e66dc28cc341 (patch) | |
tree | 9699f28042b0d612c15fcfb0800387d2787f60be /kernel | |
parent | 947492867238d47c014189a0de2d49f3e5d9bbbc (diff) | |
download | yosys-9fb715dc74b632c74aafec1652d4e66dc28cc341.tar.gz yosys-9fb715dc74b632c74aafec1652d4e66dc28cc341.tar.bz2 yosys-9fb715dc74b632c74aafec1652d4e66dc28cc341.zip |
build fix for mxe
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/driver.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/kernel/driver.cc b/kernel/driver.cc index 2cbdba8f3..1698e216c 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -409,21 +409,22 @@ int main(int argc, char **argv) #ifdef YOSYS_ENABLE_COVER if (getenv("YOSYS_COVER_DIR") || getenv("YOSYS_COVER_FILE")) { - char filename_buffer[4096]; + string filename; FILE *f; if (getenv("YOSYS_COVER_DIR")) { - snprintf(filename_buffer, 4096, "%s/yosys_cover_%d_XXXXXX.txt", getenv("YOSYS_COVER_DIR"), getpid()); - f = fdopen(mkstemps(filename_buffer, 4), "w"); + filename = stringf("%s/yosys_cover_%d_XXXXXX.txt", getenv("YOSYS_COVER_DIR"), getpid()); + filename = make_temp_file(filename); } else { - snprintf(filename_buffer, 4096, "%s", getenv("YOSYS_COVER_FILE")); - f = fopen(filename_buffer, "a+"); + filename = getenv("YOSYS_COVER_FILE"); } + f = fopen(filename.c_str(), "a+"); + if (f == NULL) - log_error("Can't create coverage file `%s'.\n", filename_buffer); + log_error("Can't create coverage file `%s'.\n", filename.c_str()); - log("<writing coverage file \"%s\">\n", filename_buffer); + log("<writing coverage file \"%s\">\n", filename.c_str()); for (auto &it : get_coverage_data()) fprintf(f, "%-60s %10d %s\n", it.second.first.c_str(), it.second.second, it.first.c_str()); |