mirror of https://github.com/YosysHQ/yosys.git
cxxrtl: fix close of invalid fd in spool destructor.
This commit is contained in:
parent
ce45011275
commit
7294d8b5af
|
@ -512,9 +512,10 @@ public:
|
||||||
spool &operator=(const spool &) = delete;
|
spool &operator=(const spool &) = delete;
|
||||||
|
|
||||||
~spool() {
|
~spool() {
|
||||||
if (int fd = writefd.exchange(-1))
|
int fd;
|
||||||
|
if ((fd = writefd.exchange(-1)) != -1)
|
||||||
close(fd);
|
close(fd);
|
||||||
if (int fd = readfd.exchange(-1))
|
if ((fd = readfd.exchange(-1)) != -1)
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue