- /* Do we need to expand the fdset array? */
- if (fd >= files->max_fdset) {
- error = expand_fdset(files, fd);
- if (!error) {
- error = -EMFILE;
- goto repeat;
- }
- goto out;
- }
-
- /*
- * Check whether we need to expand the fd array.
- */
- if (fd >= files->max_fds) {
- error = expand_fd_array(files, fd);
- if (!error) {
- error = -EMFILE;
- goto repeat;
- }
+ /* Do we need to expand the fd array or fd set? */
+ error = expand_files(files, fd);
+ if (error < 0)