diff --git a/libsrc/common/fdopen.c b/libsrc/common/fdopen.c index cfd649d75..fc8d0f776 100644 --- a/libsrc/common/fdopen.c +++ b/libsrc/common/fdopen.c @@ -21,18 +21,18 @@ FILE* __fastcall__ fdopen (int handle, const char* /*mode*/) { - FILE* f; + register FILE* f; /* Find a free file slot */ - if (!(f = _fdesc ())) { + if ((f = _fdesc ())) { + /* Insert the handle, and return the descriptor */ + f->f_fd = handle; + f->f_flags = _FOPEN; + } else { /* No slots */ - return (FILE*) _seterrno (EMFILE); /* Too many files */ + _seterrno (EMFILE); /* Too many files */ } - /* Insert the handle, and return the descriptor */ - f->f_fd = handle; - f->f_flags = _FOPEN; - /* Return the file descriptor */ return f; }