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:
Ben Davenport-Ray 2020-09-18 17:08:25 -04:00
parent 993a6469fe
commit 9278222396

2
sexp.c
View file

@ -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])