mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-22 12:33:39 -08:00
ecl_open_stream, close invalid fd cause crash on windows platform.
actually, the build process will terminated when loading
cmp/cmpos-features.lsp
related function is:
(with-open-file (s fc :direction :output :if-exists :overwrite
:if-does-not-exists :create)
it's a MS feature called security-enhanced CRT.
This commit is contained in:
parent
2283656b24
commit
5db3a78208
1 changed files with 5 additions and 3 deletions
|
|
@ -5146,7 +5146,7 @@ ecl_open_stream(cl_object filename, enum ecl_smmode smm, cl_object if_exists,
|
|||
fd = safe_open(fname, O_WRONLY|O_CREAT, mode);
|
||||
unlikely_if (fd < 0) FEcannot_open(filename);
|
||||
safe_close(fd);
|
||||
exists = 1;
|
||||
fd = -1;
|
||||
}
|
||||
switch (smm) {
|
||||
case ecl_smm_probe:
|
||||
|
|
@ -5198,7 +5198,8 @@ ecl_open_stream(cl_object filename, enum ecl_smmode smm, cl_object if_exists,
|
|||
if (file_kind == @':fifo') {
|
||||
fp = safe_fdopen(fd, OPEN_R);
|
||||
} else {
|
||||
safe_close(fd);
|
||||
if (fd >= 0)
|
||||
safe_close(fd);
|
||||
fp = safe_fopen(fname, OPEN_R);
|
||||
}
|
||||
break;
|
||||
|
|
@ -5207,7 +5208,8 @@ ecl_open_stream(cl_object filename, enum ecl_smmode smm, cl_object if_exists,
|
|||
if (file_kind == @':fifo') {
|
||||
fp = safe_fdopen(fd, OPEN_RW);
|
||||
} else {
|
||||
safe_close(fd);
|
||||
if (fd >= 0)
|
||||
safe_close(fd);
|
||||
fp = safe_fopen(fname, OPEN_RW);
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue