mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-18 21:29:19 +02:00
Prevent crashing from arithmetic exception when spawning lots of commands
This fix is rather dumb, but it prevents things from crashing when forking a lot and creating file handles. I assume that this is where the filehandles go, but I don't have a good guess.
This commit is contained in:
parent
993a6469fe
commit
9278222396
1 changed files with 2 additions and 0 deletions
2
sexp.c
2
sexp.c
|
@ -1806,6 +1806,8 @@ static sexp* sexp_fileno_cell(sexp ctx, sexp vec, int fd) {
|
|||
if (!sexp_vectorp(vec))
|
||||
return NULL;
|
||||
len = sexp_vector_length(vec);
|
||||
if (len == 0)
|
||||
return NULL;
|
||||
data = sexp_vector_data(vec);
|
||||
for (i = 0, cell = (fd * FNV_PRIME) % len; i < len; i++, cell=(cell+1)%len)
|
||||
if (!sexp_ephemeronp(data[cell])
|
||||
|
|
Loading…
Add table
Reference in a new issue