mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-07 01:54:10 +00:00
Fixed proc_{self,share}_dirname error handling
This commit is contained in:
parent
aa3a6663e2
commit
aa7a3ed83f
|
@ -207,8 +207,7 @@ std::string proc_self_dirname ()
|
||||||
char path [PATH_MAX];
|
char path [PATH_MAX];
|
||||||
ssize_t buflen = readlink("/proc/self/exe", path, sizeof(path));
|
ssize_t buflen = readlink("/proc/self/exe", path, sizeof(path));
|
||||||
if (buflen < 0) {
|
if (buflen < 0) {
|
||||||
log_cmd_error("readlink(\"/proc/self/exe\") failed: %s", strerror(errno));
|
log_error("readlink(\"/proc/self/exe\") failed: %s\n", strerror(errno));
|
||||||
log_abort();
|
|
||||||
}
|
}
|
||||||
while (buflen > 0 && path[buflen-1] != '/')
|
while (buflen > 0 && path[buflen-1] != '/')
|
||||||
buflen--;
|
buflen--;
|
||||||
|
@ -239,8 +238,7 @@ std::string proc_share_dirname ()
|
||||||
proc_share_path = proc_self_path + "../share/yosys/";
|
proc_share_path = proc_self_path + "../share/yosys/";
|
||||||
if (access(proc_share_path.c_str(), X_OK) == 0)
|
if (access(proc_share_path.c_str(), X_OK) == 0)
|
||||||
return proc_share_path;
|
return proc_share_path;
|
||||||
log_cmd_error("proc_share_dirname: unable to determine share/ directory!");
|
log_error("proc_share_dirname: unable to determine share/ directory!\n");
|
||||||
log_abort();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fgetline(FILE *f, std::string &buffer)
|
bool fgetline(FILE *f, std::string &buffer)
|
||||||
|
|
Loading…
Reference in a new issue