mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-20 06:09:18 +02:00
Merge pull request #705 from laserswald/fix-arithmetic-exception-filenos
Prevent arithmetic exception when spawning lots of commands
This commit is contained in:
commit
7448c22466
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))
|
if (!sexp_vectorp(vec))
|
||||||
return NULL;
|
return NULL;
|
||||||
len = sexp_vector_length(vec);
|
len = sexp_vector_length(vec);
|
||||||
|
if (len == 0)
|
||||||
|
return NULL;
|
||||||
data = sexp_vector_data(vec);
|
data = sexp_vector_data(vec);
|
||||||
for (i = 0, cell = (fd * FNV_PRIME) % len; i < len; i++, cell=(cell+1)%len)
|
for (i = 0, cell = (fd * FNV_PRIME) % len; i < len; i++, cell=(cell+1)%len)
|
||||||
if (!sexp_ephemeronp(data[cell])
|
if (!sexp_ephemeronp(data[cell])
|
||||||
|
|
Loading…
Add table
Reference in a new issue