-/* Copyright (C) 1994, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
else if (size <= first_fd)
size = first_fd + 1;
+ if (size * sizeof (*_hurd_dtable) < size)
+ {
+ /* Integer overflow! */
+ errno = ENOMEM;
+ goto out;
+ }
+
/* If we fail to allocate that, decrement the desired size
until we succeed in allocating it. */
do
/* Go back to the loop to initialize the first new slot. */
goto search;
}
+ else
+ errno = ENOMEM;
}
else
errno = EMFILE;
else
errno = EINVAL; /* Bogus FIRST_FD value. */
+ out:
__mutex_unlock (&_hurd_dtable_lock);
_hurd_critical_section_unlock (crit);