fixup fsid correctly in union_getattr
[unix-history] / usr / src / sys / stand.att / close.c
CommitLineData
a8d10b60 1/*-
80409bdc
KB
2 * Copyright (c) 1982, 1988, 1993
3 * The Regents of the University of California. All rights reserved.
a8d10b60
KB
4 *
5 * %sccs.include.proprietary.c%
6 *
80409bdc 7 * @(#)close.c 8.1 (Berkeley) %G%
a8d10b60
KB
8 */
9
10#include <sys/param.h>
61ef809e 11#include <stand.att/saio.h>
a8d10b60
KB
12
13close(fdesc)
14 int fdesc;
15{
16#ifndef SMALL
17 struct iob *file;
18
19 fdesc -= 3;
20 if (fdesc < 0 || fdesc >= SOPEN_MAX ||
21 ((file = &iob[fdesc])->i_flgs&F_ALLOC) == 0) {
22 errno = EBADF;
23 return (-1);
24 }
25 if ((file->i_flgs&F_FILE) == 0)
26 devclose(file);
27 file->i_flgs = 0;
28#endif
29 return (0);
30}