some coverity fixes.
[minix.git] / lib / libasyn / asyn_close.c
bloba0154f9809f4da119a55a150c409a1f7c0ae54c0
1 /* asyn_close() - forcefully forget about a file descriptor
2 * Author: Kees J. Bot
3 * 7 Jul 1997
4 */
5 #include "asyn.h"
7 int asyn_close(asynchio_t *asyn, int fd)
8 /* Stop caring about any async operations on this file descriptor. */
10 asynfd_t *afd;
11 int op;
13 if ((unsigned) fd >= FD_SETSIZE) { errno= EBADF; return -1; }
15 afd= &asyn->asyn_afd[fd];
17 for (op= 0; op < SEL_NR; op++) {
18 afd->afd_state[op]= IDLE;
19 FD_CLR(fd, &asyn->asyn_fdset[op]);
21 afd->afd_seen= 0;
22 asyn->asyn_more++;
23 return 0;