static const char *get_cwd(void)
{
static char buf[1024];
- if (buf[0] == '\0')
- getcwd(buf, sizeof(buf));
+ if (buf[0] == '\0') {
+ return getcwd(buf, sizeof(buf));
+ }
return buf;
}
} else {
be_dwarf_set_source_language(DW_LANG_C);
}
- be_dwarf_set_compilation_directory(get_cwd());
+ const char *cwd = get_cwd();
+ if (cwd != NULL) {
+ be_dwarf_set_compilation_directory(cwd);
+ }
/* initialize firm arithmetic */
tarval_set_integer_overflow_mode(TV_OVERFLOW_WRAP);